How to Send Webhooks Via Chatbots

A webhook is a mechanism for transferring data to your system about user-generated events. It sends an HTTP request to your handler.

Using this integration you can collect and send data about events in a chatbot’s flow to your system for further work with this client.

Use case example, imagine: you created a form for new users to reserve a place at your conference using messenger. You want to know about each user that registered for a specific lecture so you can contact them or change their status in your CRM.

You can accomplish this goal easily by sending a webhook. As soon a user reaches the webhook element in your flow, the event data will send to your data storage system (i.e. CRM, CMS, site, etc) for future use.

How to add a webhook to your chatbot flow

Add an “Action” element after the element that you want to track. Choose the option “Send webhook”. Enter a title for the webhook and the URL where data will be sent.

You can track:

  • “Message” elements - user input, using a specific button;
  • “Action” elements - opening chat with admin, unsubscribing, updating variable, or adding a tag.

You can also specify events for which webhooks will be sent in the bot settings section. Enter a link to your handler and select the events themselves.

Send data about the actions of subscribers to your system with the following events: 

  • Bot subscription
  • Incoming messages
  • Opened live chat
  • Launched custom trigger flow
  • Redirect
  • Bot unsubscribe
  • Bot blocked

Webhook structure

A webhook сan transmit data about:

  • the date an action was completed;
  • title of the webhook - you can filter your audience based on if they received a webhook by its “title”;
  • information about the bot and the social page it is linked to- identification, photo, link to a page;
  • information about the contact who triggered event - their identifier, name, date of birth, city, country, profile photo, any existing variables, and tags.

Webhook data example:

        "info": null, // information from messenger
        "service": "messenger", // messenger - Facebook chatbot, telegram - Telegram chatbot
        "title": "Reserved. Apartment #3" // title of the webhook
        "bot": {
            "url": "",
            "external_id": "104117781360763", // community identifier in the messenger (for Facebook, the value is passed as a “string”, for Telegram and VKontakte as a number).
            "id": "17ff4105-d5f1-4790-9d09-a6f64ea73d54", // identifier of the connected bot in SendPulse
            "name": "BEST" // 
        "contact": {
           "name of variable": "value of variable",
            "email": "",
            "phone": "+38093000000",
            "last_message": "hey! whats up?", // last message of the user
            "photo": "https://..",
            "tags": ["tag1", "tag2"],
            "id": "467bf50f-9cb0-4b65-b722-0135ad5fb9e0", // contact’s identifier in SendPulse
            "name": "Alexander"
        "date": 1617401679 // execution date and time in milliseconds

An example of a webhook for "Incoming messages":

      "info":{ // information from messenger
                     "body":"hey! whats up?"
         "last_message":"hey! whats up?", // last message of the user
Webhook data format changes
Note! The webhook data format was changed on August 11, 2020. Now it is an array of objects [{...}, {...}]. Previously, there was one data object {...}. Update your integrations if they use the old format.

Webhook data is sent with a content type “application/json”.

Rate this article about "How to Send Webhooks Via Chatbots"

User Rating: 4 / 5 (13)

    Other useful articles

    Popular in Our Blog

    Try a free chatbot for Facebook Messenger