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

FieldDescription
typeBy default, this is: action
verifyTokenThe verify token you specified in the webhook configuration
threadIdThe ID representing the thread that triggered the webhook call
channelNameName of the channel on which the Webhook call was triggered
queryOptionally, a user query that triggered this Webhook call
actionEach action triggering a Webhook call can customize this. See the Design app
paramsOptional object with params retrieved by Flow.ai
originatorThe sender of the action
userThe user that triggered the Webhook call
replyUrlA 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

FieldDescription
valueThe extracted value
matchOptionally, the piece of matched text
typeOptionally, the type of extracted data

More Information

See Node.js webhook example project for more information.