Details
Salesforce Live Agent advanced details.
The following code demonstrates how a "transfer to agent" flow might look in Live Agent. There are a number of features particular to Salesforce Live Agent, which are explained below.
To see a complete version of a Live Agent bot, check out this Github repo.
states:
transfer:
component: human.transfer
properties:
text: Transferring you to a sales agent
note: |
Customer wants to apply for a card
Name - {{ user.first_name }}
Surname - {{ user.last_name }}
Income - {{ user.income }}
timeout: 60
timeout_flow: agent_timeout
timeout_data:
x: "X"
y: "Y"
chat_request_success:
flow: chat_request_success_flow
data:
success: "yes"
chat_established:
flow: chat_established_flow
data:
established: "yes"
chat_ended:
flow: chat_ended_flow
data:
ended: "yes"
chat_request_failed:
flow: chat_request_failed_flow
data:
request_failed: "yes"
chat_agent_disconnect:
flow: chat_agent_disconnect_flow
data:
agent_disconnect: "yes"
chat_transferred:
flow: chat_transferred_flow
data:
transferred: "yes"
queue_update:
flow: queue_update_flow
data:
queue_update: "yes"
visitor_details:
Name__c: "{{ user.first_name }}"
Surname__c: "{{ user.last_name }}"
Income__c: "{{ user.income }}"
If you've used another customer service integration, some of the human.transfer
fields will look familiar.
Field | Description | Notes |
---|---|---|
text | Text to display to the user. | Optional |
speech | Text to speak to the user. | Optional Only applies to voice integrations |
note | Text to display only to the agent. | Optional |
timeout | If an agent doesn't accept the conversation within this number of seconds, the flow specified by timeout_flow will be executed. If no timeout_flow is indicated, no flow will be executed. | Optional |
timeout_flow | The flow to execute if the agent doesn't respond to the conversation within the number of seconds specified by timeout .Note: The agent must respond via text. Accepting the conversation is not sufficient to cancel the timeout. | Optional |
timeout_action | The action to invoke when starting the timeout flow. | Optional Default: null. |
timeout_data | Data to send to the timeout flow. | Optional |
visitor_details | A list of Salesforce fields that will be updated or created. If a field exists, the field will appear in both the transcript details as well as the visitor details. If the field doesn't exist, the field will only appear in the visitor details. | Optional |
Callback flows
In addition to the above fields, a number of "callback" flows can be triggered based on certain events occurring in Live Agent.
If you don't explicitly handle these events, nothing will happen. It's a good idea to handle them so your user knows what's going on.
Field | Description | Notes |
---|---|---|
chat_request_success | This flow will be triggered when a chat session has been established with Live Agent. Useful for displaying queue information on first connect. | Optional |
chat_established | This flow will be triggered when an agent accepts the chat request. | Optional |
chat_ended | This flow will be triggered when the user or agent ends the conversation. | Optional |
chat_request_failed | This flow will be triggered if no agent is available, or every agent rejects the conversation. | Optional |
chat_agent_disconnect | This flow will be triggered if the agent disconnects from the session. | Optional |
chat_transferred | This flow will be triggered every time the conversation is transferred to another agent. | Optional |
queue_update | This flow will be triggered every time the user's position in the queue changes. | Optional |
Each of the four event handlers above has the following two fields.
Field | Description | Notes |
---|---|---|
flow | The flow to execute when the event occurs. | Required for any callback event you want to handle. |
data | Data to pass to the flow. | Optional |
Bot pause/un-pause
In order to handle these callback flows, your bot will be automatically un-paused. At the end of each callback flow, remember to use the
meya.pause
component to pause the bot again, otherwise your use might see unexpected behaviour.
The five tabs in the code block below demonstrates what the five callback flows could look like.
states:
check_position_state:
component: meya.conditional_equal
properties:
value1: '{{ flow.queue_position }}'
value2: 0
transitions:
equal: agent_queue_state
notequal: main_queue_state
main_queue_state:
component: meya.text_buttons
properties:
text: "You are now in queue position {{ flow.queue_position }}"
buttons:
- text: "Continue Waiting"
action: continue
- text: "Return to Bot"
action: return_to_bot
transitions:
continue: continue_waiting_state
return_to_bot: return_to_bot_state
agent_queue_state:
component: meya.text_buttons
properties:
text: |
You have been assigned to an agent but the agent still needs
accept your chat.
buttons:
- text: "Continue Waiting"
action: continue
- text: "Return to Bot"
action: return_to_bot
transitions:
continue: continue_waiting_state
return_to_bot: return_to_bot_state
continue_waiting_state:
component: meya.pass
return_from_continue_waiting_state:
# Pause the bot again while we wait for an agent.
component: meya.pause
return: true
return_to_bot_state:
# Close the human.transfer session and let the bot takeover
component: human.close
return: true
states:
first:
component: meya.text
properties:
text: "You are now talking to {{ flow.agent_name }}."
return_state:
component: meya.pause
states:
text_state:
component: meya.text
properties:
text: "The agent chat has ended."
states:
text_state:
component: meya.text
properties:
text: "The agent has disconnected."
states:
first_state:
component: meya.text
properties:
text: "Transferring you to agent {{ flow.agent_name }}."
return_state:
component: meya.pause
states:
first:
component: meya.text
properties:
text: "No agent is available at the moment. Please try again later."
states:
check_position_state:
component: meya.conditional_equal
properties:
value1: '{{ flow.queue_position }}'
value2: 0
transitions:
equal: agent_queue_state
notequal: main_queue_state
main_queue_state:
component: meya.text_buttons
properties:
text: "You are now in queue position {{ flow.queue_position }}"
buttons:
- text: "Continue Waiting"
action: continue
- text: "Return to Bot"
action: return_to_bot
transitions:
continue: continue_waiting_state
return_to_bot: return_to_bot_state
agent_queue_state:
component: meya.text_buttons
properties:
text: |
You have been assigned to an agent but the agent still needs
accept your chat.
buttons:
- text: "Continue Waiting"
action: continue
- text: "Return to Bot"
action: return_to_bot
transitions:
continue: continue_waiting_state
return_to_bot: return_to_bot_state
continue_waiting_state:
component: meya.pass
return_from_continue_waiting_state:
# Pause the bot again while we wait for an agent.
component: meya.pause
return: true
return_to_bot_state:
# Close the human.transfer session and let the bot takeover
component: human.close
return: true
human.note
Using human.note
, you can add a private message only agents can see.
states:
leave_note:
component: human.note
properties:
text: "They are a great customer! Treat them right."
human.close
You can end the conversation with the agent from within a flow by using the human.close
component.
states:
close_chat:
component: human.close
meya.pause
If you're using any callback flows, the bot will be automatically un-paused so that it can execute the flow. At the end of each callback flow you must remember to use the meya.pause
component to pause the bot again, otherwise the user may see unexpected behaviour.
Be careful with meya.pause!
meya.pause
should only be used at the end of Live Agent callback flows. Once the Live Agent conversation ends, the bot will automatically un-pause. The only other way to un-pause the bot aftermeya.pause
has been used is via API call.Using
meya.pause
outside of a Live Agent callback flow will result in the bot being permanently paused for that user, until you explicitly make an API call to un-pause it for that user.
states:
pause_bot:
component: meya.pause
Agent/team assignment
Agent or team assignment is not supported in Salesforce Live Agent.
Transcript history
Unlike some other CRM integrations, Live Agent won't automatically have access to the entire conversation leading up to the transfer. You can, however, specify the number of messages to send to Live Agent, which will "pre-load" the agent's conversation providing them some context. The default value is 10.
Note that the number of messages specified includes user messages and bot messages.
Slash commands
Live Agent does not support the ability for agent's to issue commands to the bot (i.e. "slash commands").
Other CRM integrations use the three-party chatbot paradigm: user, bot, and agent. Live Agent uses a two-party paradigm: user, and agent. Since there is no way for the agent to talk to the bot, slash commands cannot be implemented.
Timeout error
If the Salesforce Live Agent API is slow to respond, you may get a SoftTimeLimitExceeded
error.
These errors appear when the Salesforce Live Agent API doesn't respond within 3 seconds. If this happens regularly, you may request an increased timeout limit by contacting [email protected]. Note that your request may not be approved.
Updated almost 6 years ago