NAV Navbar
curl

Poll for new chat message

Overview

Check for new chat messages, recommend interval no more than 1-2 seconds. Please see the cURL tab to the right for an example.

GET /api/v1/chat/poll/{caseId}

Request Parameters

Data Type Description
caseId String Unique identifier of chat session. (Obtained from Start New Chat API response: POST /api/v1/chat)
index Integer (Optional, default 0) The start index of chats to return.
isTyping Boolean (Optional, default false) Is the visitor currently typing a message?

Sample Request

Please see the cURL tab to the right for an example.

curl -i -H 'X-Api-Key:4a9fecdd4c344f279a59d9446157636e' 'https://www.snapengage.com/api/v1/chat/poll/44843c55-527c-4f03-a779-e0ce655219f7?index=1&isTyping=false'

Response Parameters

Data Type Description
caseId String Unique identifier of chat session.
agentTyping Boolean true if the agent is currently typing a message.
messageList Array array of messages.
↳index Integer Index of the chat message in the transcript.
↳type String Either “agent” or “system”.
↳author String Id of the message author (agent or visitor).
↳text String Chat message text.

Success Response

200 OK

Please see the json tab to the right for an example.

{
  "caseId":"44843c55-527c-4f03-a779-e0ce655219f7",
  "agentTyping":false,
  "messageList":[
    {
      "index":0,
      "type":"agent",
      "author":"Joe Agent",
      "text":"Hello how are you?"
    }
  ]
}