Handover conversation flow

This part of the flow explains how the conversation with the bot is passed to an agent.

Chat_API_Sequence_-_Claim_Conversation_Flow_2.png

Below, we provide explanations for each of the requests made from processes 1 - 6 seen in the diagram above.

  1. In the process of the conversation at some point, there should be a Module in which a Webhook is added. This Webhook can be provided by the third-party system, or the one provided by the Certainly Platform can be used.
     
    1A. If using the Certainly Platform, the Webhook should be set to https://app.certainly.io/bot/transfer/human
     
    1B. If using the third-party system to inform in that system that the intervention of a human is being claimed, Certainly starts a POST to the URL defined in the Webhook, and sends a body with the following structure:
    {
    "attachedMedia":"url_to_the_file",
    "reply":"VarWebhook",
    "botId":"",
    "direction":"out",
    "extractedData":{ },
    "lastName":"last_name taken from facebook if available",
    "sessionId":"",
    "customVariables":{ },
    "from":"token",
    "firstName":"first_name taken from facebook if available",
    "to":"user_id",
    "replyData":"",
    "moduleId":"",
    "botTrainedModelId":""
    }
     
  2. GET/webbot/api/webchat/{botId}/handover/{userId}/
     
    Certainly exposes this Endpoint for the third-party system to hand over the conversation when needed. Once it is called, the bot changes from normal mode to listen mode, and from this point on, it won't respond to any message received from the user.

  3. This is the already-established WebSocket connection. From the JS Client perspective, the conversation stays the same, and the messages sent by the user are sent to Certainly.
     
  4. This is the Webhook to send the messages to the third-party platform. This Webhook is configured in the Bot Settings if different Webhooks are required for every bot, or in company settings if the same Webhook can be used for different bots. The POST requests send a JSON with interlocutor "user".
     
  5. POST /webbot/api/webchat/{botId}/handover/{userId}/
     
    This Endpoint is used for the third-party system or external agent to post responses to the user. The body should be like the following example:
    {
    "message":"Hello from Agent!"
    }

      

  6. This is the already-established WebSocket connection. From the JS Client perspective, the conversation stays the same, and the messages received by the user from the new interlocutor make no difference from those received from the bot.