Receiving Calls
Webhook actions are triggered using actions similar to cloud code. Simply drag and drop them below any trigger, then select the action.
POST Request
When a webhook is triggered, Khoros Flow sends data in JSON format to your callback URL.
{
"type": "action",
"verifyToken": "b34768df-4768-4768-8cfe-0ac99db46ca9",
"threadId": "99eb45ed85a0a00cef41f55aa03bea17",
"channelName": "socket",
"query": "hi",
"action": "onboarding",
"params": {
},
"originator": {
"actorId": "23249a99-a243-448b-asdf-daddd7bafb6c",
"userId": "flowai|23249a99-1233-448b-ada1-daasafbafb6c",
"name": "EN Bot",
"role": "bot",
"profile": {
"description": "Flow.ai",
"locale": "en",
"picture": "https://flow.ai/img/brains/flowai.svg"
}
},
"user": {
"name": "Jane Doe",
"role": "external",
"profile": {
"fullName": "Jane Doe",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.ai",
"picture": "https://...",
"locale": "nl",
"timezone": 2,
"gender": "M"
}
},
"replyUrl": "https://..."
}
Post Request Field Information
Field | Description |
---|---|
type | By default, this is: action |
verifyToken | The verify token you specified in the webhook configuration |
threadId | The ID representing the thread that triggered the webhook call |
channelName | Name of the channel on which the Webhook call was triggered |
query | Optionally, a user query that triggered this Webhook call |
action | Each action triggering a Webhook call can customize this. See the Design app |
params | Optional object with params retrieved by Flow.ai |
originator | The sender of the action |
user | The user that triggered the Webhook call |
replyUrl | A unique url to be used to reply to this thread on the correct channel |
Note
You can control the value of
action
from within the designer, like in the above onboarding example, which makes it easy to use a single endpoint with different actions.
Parameters
Cloud code expects a set of various parameters. For example, when a user shares a file or a bot detects a named entity, it gives various parameters.
{
"type": "action",
"verifyToken": "...",
"threadId": "...",
"channelName": "alexa",
"query": "What is the weather like in Toronto?",
"action": "get-weather-report",
"params": {
"city": [
{
"match": "Toronto",
"type": "system.query",
"value": "Toronto"
}
]
},
...
}
From the above example, you can see that the engine extracts data and places it into a params object. Each parameter is always a list (array), allowing multiple results.
{
"type": "action",
"verifyToken": "...",
"threadId": "...",
"channelName": "amazon",
"query": "What is the weather like in New York and Toronto?",
"action": "get-weather-report",
"params": {
"city": [
{
"match": "New York",
"type": "system.query",
"value": "New York"
},
{
"match": "Toronto",
"type": "system.query",
"value": "Toronto"
}
]
},
...
}
Parameters Field Information
Field | Description |
---|---|
value | The extracted value |
match | Optionally, the piece of matched text |
type | Optionally, the type of extracted data |
More Information
See Node.js webhook example project for more information.
Updated 3 days ago