Receiving messages (Flow Socket)
Learn about receiving message response information for the Flow socket API
The format for both received replies and sent messages is the same.
Payload Example
The following is an example of receiving a message example or reply.
{
"type": "message.received",
"payload": {
"threadId": "EXAMPLE8917250d54bcbb596",
"messages": [
{
"fallback": "hallo",
"responses": [
{
"type": "text",
"payload": {
"text": "hallo"
}
}
]
}
],
"originator": {
"userId": "USERID4bcbb59657a8a2a891",
"name": "USER NAME",
"role": "user",
"profile": {
"fullName": "USER NAME",
"firstName": "USER",
"lastName": "NAME",
"locale": "nl",
"gender": "M",
"picture": "https://flowai.domain.com/identities/profile/EXAMPLE-318a-4d58-b5e1-b430934b8e23"
}
}
}
}
The following table has the payload message parameters and descriptions.
Parameter | Description | Type |
---|---|---|
threadId | Required. A unique key that identifies a user or channel. | string |
messages | List of Message templates | array |
originator | Similar to the originator when sending messages | object |
Advanced Reply Example
The following is an example of receiving a message with an advanced reply.
{
"type": "message.received",
"payload": {
"threadId": "EXAMPLE327348ed3bd1439e7b",
"messages": [
{
"fallback": "Hi, how can we help?",
"silent": false,
"replyTo": "event attachment",
"originator": {
"userId": "flowai|system",
"name": "system",
"role": "bot",
"profile": {
"picture": "https://flow.ai/img/EXAMPLE/flowai.svg"
}
},
"actions": [],
"responses": [
{
"type": "text",
"payload": {
"text": "Hi, how can we help?",
"quickReplies": [
{
"label": "Chat with flow.ai",
"value": "Chat with someone from flow.ai",
"type": "text"
},
{
"label": "Call flow.ai",
"value": "What is your phone number?",
"type": "text"
},
{
"label": "Ask a question",
"value": "I want to ask a question",
"type": "text"
}
]
},
"delay": 0
}
],
"flow": {
"flowId": "EXAMPLE-9335-4e74-abb3-5745d26707f7",
"title": "Intro"
},
"step": {
"stepId": "EXAMPLE-e526-4252-b70c-e6e5af3338e0",
"title": "INTRO",
"type": "EVENT"
},
"params": {
"event": [
{
"type": "custom",
"value": {
"name": "INTRO"
}
}
]
}
}
],
"originator": {
"userId": "flowai|system",
"name": "system",
"role": "bot",
"profile": {
"picture": "https://flow.ai/img/EXAMPLE/flowai.svg"
}
}
}
}
The following table has the advanced reply message parameters and descriptions.
Parameter | Description | Type |
---|---|---|
fallback | Speech representation of the message | string |
silent | True if the message does not have any output for a user | boolean |
replyTo | Optionally contains the text the message is a direct reply to | string |
originator | Originator specific to this message | object |
actions | Optional action names being called | array |
responses | Collection of response templates | array |
flow | Information about the matched flow | object |
step | Information about the matched step | object |
params | Hash table with Parameters | object |
More information
See our complete reference of the JSON responses in Github for more information.
Updated 3 days ago