Sending Messages

This documentation is preliminary and is subject to change any given moment.

You can send a message by sending JSON using the websocket connection.

Simple message

{
  "type": "message.send",
  "payload": {
    "traceId": 1,
    "threadId": "31ea9df73ca74dfe9329bf68c09b61ce",
    "traceId": 1489399519321,
    "speech": "hi"
  }
}
Fields
Property Description Type
threadId Unique key identifying a user or channel string
traceId Optional number used to track message delivery integer
speech Text of message string

Response

A reply is send (almost) instantly. The following is replied if the message is successfully delivered.

{
  "type": "message.delivered",
  "payload": {
    "traceId": 1,
    "threadId": "31ea9df73ca74dfe9329bf68c09b61ce",
    "traceId": 1489399519321,
    "speech": "hi"
  }
}

If there is an error processing a message the server will reply with an error. For example:

{
  "type": "error",
  "message": "Invalid message format"
}

Advanced message

With each message it's possible to send additional data. This enables a client to send additional data to a custom service listening to events like Webhooks and Cloud functions.

{
  "type": "message.send",
  "payload": {
    "threadId": "31ea9df73ca74dfe9329bf68c09b61ce",
    "traceId": 1489399519321,
    "speech": "hi",
    "originator": {
      "fullName": "John Doe",
      "role": "External",
      "gender": "m"
    },
    "metadata": {
      "contexts": [
        "web",
        "customer"
      ],
      "params": {
        "location": "New York"
      }
    }
  }
}

results matching ""

    No results matching ""