Resuming a conversation and when it's considered expired

In this article, we'll explore the process of resuming a conversation with a user and address when a conversation is considered expired.

Resuming a conversation

When resuming a conversation with the same user id, these are the steps that occur to continue the conversation for the bot to send and receive messages to the user.

  1. In order to resume a conversation, the user needs to send the same user ID in the message sent to the WebSocket connection, like below:
     
    GET (WS://) /webbot/api/webchat/{botId}/
     
  2. The message is sent through the WebSocket with the same user ID:
    {

      "message": {

        "from": "human",

        "user_profile": {},

        "ref": null,

       "user_id": "webbot:2d6bdb10-b237-11ea-a038-abed322efde6", // same user id used in other conversations

        "timestamp": 1592576064,

        "attachments": [],

        "id": "1592576064324",

        "actions": [

          {

            "type": "text",

            "text": ""

          }

        ]

      }

    }
     
  3. With this same user ID, the conversation is detected as an active conversation, and it resumes from the Module from which the last message was sent.

When a conversation is considered expired

A conversation is considered expired when the session expiration time has been exceeded. The session expiration time can be set in Bot Settings. Here, the conversation is changed from active to non-active.