Setting Webhook

Webhook defines a notification event to be sent and handled by your application, passing on the data that identifies the step in the flow to which webhook corresponds to the user has arrived, another out-of-flow action.

There are two ways to enable the webhook, by choosing the Webhook option from the Redirect Type or, after setting both Redirect Type and Redirect To.

You have the option to enable the webhook from the Welcome Message or Interaction.

📘

NOTE

If you select the Webhook as the Redirect type, the Menu Text and Redirect To will not be available.

By enabling the webhook, your endpoint must have a POST access method and receive a JSON body.

You must type the following URL structure on the URL placeholder:

POST https://<Your_Domain>/<Your_Path>

The Webhook is divided by two components: Payload and Headers.

  • Payload: The URL typed is the external callback where the events of the message will be registered and published. That is, the following example parameters sent to your callback URL will be the events to be recorded in the callback once the end users begin to participate in your campaign:

    ParameterDescription
    "campaignId"Unique identifier of the campaign.
    "label"Section of the chatbot. In this example, we are located in the Welcome Message section.
    "phoneNumber"Phone number of the end user.
    "date"Date when the Webhook receives the message.

    The date is represented with date in UTC Zulu format: (yyyy-mm-dd-Thh:mm:ss.ssZ).
    "response"Response from the end user who participated in the campaign.

    If you want to add additional parameters, from the Body textbox type in JSON format each parameter.

    📘

    NOTE

    If the webhook was enabled after configuring the Redirect Type and Redirect To, two extra parameters will be sent to your callback URL: “option”, “keyword”.

    • “option”: Option used by the end user who participated in the campaign.
    • “keyword”: Keyword used by the end user who participated in the campaign.
  • Headers: You can specify custom headers that the platform will use while sending the payload to the specified webhook endpoint. Custom headers give the destination application an option to authenticate your webhook requests, and reject any that do not contain these custom headers.

    The headers use key-value parameters that are sent as part of the webhook request. The values of these key-value pairs are visible and editable in the webhook editor by selecting the Edit icon once the key-value have been added. And, you are able to delete the key-value by selecting the Delete icon.

    As Header example, the following headers key-value will be sent with all requests:

As an example representation when configuring the chatbot, note the Actions icons at the far right of the table for editing or deleting a menu entry. And to the right of the icons a link icon that denotes the presence of a webhook associated with the option, where the first webhook is explicitly as a webhook Redirect to, while the other two are webhooks associated with the selection of an interaction and a campaign, an underlying webhook.

Graphically, from top to bottom they are as shown below.

To summarize the graphic, there are two outcomes that remain within the platform, options 1 and 4 of the menu (blue arrows), with option 1 being a plain interaction and option 4 and interaction (blue arrow) with a webhook underlying it (black arrow).

There are two outcomes that have platform campaigns as their next action, options 2 and 5, with option 2 invoking a Raffle Giveaway campaign (red arrow), and option 5 invoking a Web Polls & Surveys campaign (read arrow) with an underlying webhook (black arrow).