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.

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.

Example body parameters for a POST request:

{
    "date": 1589542610, // execution date and time in milliseconds 
    "contact": {
        "variables": {
            "name of variable": "value of variable", 
            "email": "name@example.com",
            "phone": "+38093000000",
"photo": "https://.."
}, "tags": ["tag1", "tag2"], "id": "0278981b-92f4-4bbb-8353-627b000d463", // identifier of the contact in your SendPulse audience list "name": "Alexander" }, "bot": { "url": "https://m.me/652333600223330", "external_id": "6523336910330", "id": "064faef8f5251e35a68", // identifier of the connected bot in SendPulse "name": "Svitapp" // name of the page }, "service": "facebook", "title": "Reserved. Apartment #3" // title of the webhook }

Webhook data is sent with a content type “application/x-www-form-urlencoded”.

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

User Rating: 4 / 5 (10)

    Other useful articles

    Popular in Our Blog

    Try a free chatbot for Facebook Messenger