Transfer the Bot Session to Another Target

If the bot can’t process an incoming request because of but not limited to an error or exception, it can respond with an escalation message. An escalation message is a transfer request from the bot to a different bot, agent, agent queue, Salesforce skill, or Salesforce flow.

Here’s an example of a customer being transferred to an agent queue. The messages array in this response body has the escalate message type. The QUEUE_ID is a UUID of the queue target set up by the Salesforce admin.

The API itself doesn’t route the bot session to another target. The API only responds with an array of target objects configured by the bot-admin. The client is responsible for transferring the session to one of the targets after receiving an escalation message from the bot. After the client routes the session to another target, the client must send back a transfer success or transfer failed message to the bot.

Let’s consider a “bot to support agent” escalation example. In this example, the Salesforce admin has set up an Omni-Channel queue called “Customer Support Queue”. This queue accepts standard Salesforce Case object records, and support agents can pick up the cases from the queue.

Now, the bot responds to the client with an escalate message type with the value of the targets object set to the corresponding UUID of the “Customer Support Queue”. The client can then call a standard Salesforce API to create a case record with the OwnerId field set to the “Customer Support Queue” UUID. Here’s an example code of how to create this case record.

The case record is then added to the support agent queue, and the Omni-Channel queuing system handles the rest.

If the client successfully creates a case record and adds it to the support agent queue, the client must send a transfer success message to the bot, as described in the next section. If it fails, the client must send a transfer failed message to the bot. The client can then End a Session.

Here’s an example where the client sends a transfer success message to the bot. The message type is transferSucceeded.

If the bot sends an escalation message, but the client isn’t able to transfer to the directed source, the client must send a transfer failed message to the bot.

Here’s an example of a transfer failed message. The message type is transferFailed.

If the transfer fails, the bot moves to the No Agent dialog. You can configure this dialog to route the customer to a different transfer target, a different dialogue, or other options. See Understanding System Bot Dialogs.