Documentation - Flow.ai
  • Getting started
  • Triggers & Replies
  • Actions
  • Integrations
  • Guides
  • API

›Webhook actions

Actions

  • Overview
  • When and why
  • Code actions

    • Overview
    • Payload
    • Toolbelt
    • API Calls
    • Configuration
    • Triggering Events
    • Sending Replies
    • Params
    • Managing State
    • Debugging

    Webhook actions

    • Overview
    • Receiving calls
    • Sending Replies

    Zapier actions

    • Overview

    Payments

    • Overview
    • Stripe Single Purchase
    • Stripe Prepared Product Purchase
    • Examples of Stripe Purchases

    Webviews

    • Overview
    • Article
    • Date Picker
    • Radio select
    • Multiple Select
    • Terms

Receiving calls

Just like Cloud code, Webhook actions are triggered using actions. Simply drag and drop them below any trigger and select the action.

POST Request

Whenever a webhook is triggered Flow.ai sends along 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": "[email protected]",
      "picture": "https://...",
      "locale": "nl",
      "timezone": 2,
      "gender": "M"
    }
  },
  "replyUrl": "https://..."
}

Reference

PropertyDescription
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 customise 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
replyUrlUnique url to be used to reply to this thread on the correct channel

Action:

You can control the value of action, like in the example above (onboarding), from within the designer. This makes it easy to use a single endpoint with different actions.

Params

As with Cloud code you can expect a set of various params. For example a user shares a file or the bot detects a named entity.

{
  "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"
      }
    ]
  },
  ...
}

In the above example you can see that the engine extracted data and placed it into a params object. Each param 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"
      }
    ]
  },
  ...
}

Reference

PropertyDescription
valueThe extracted value
matchOptionally, the piece of text that matched
typeOptionally, the type of data that was extracted

Further reading

  • Node.js webhook example project
← OverviewSending Replies →
  • POST Request
    • Reference
  • Params
    • Reference
  • Further reading
Docs
Getting StartedBasic conceptsGuides
Platform
StatusSlack community
Resources
Blog
Copyright © 2021 Flow.ai