The Webhook element allows you to import or export data to any external system: your own Webhook, Zapier, IFTTT or any other system that responds to the HTTP protocol.

To do this, enter the url of the service you want to call. The url must be in HTTPS (http secure).

You can add parameters by either adding them directly to the URL or by using the + Add parameter option.

The url will be called by Botnation AI in GET.

You'll find a more complete example of exporting to a Google Sheet via Zapier here: http://help.botnation.ai/help-in-english/export-data-to-a-google-sheet-using-zapier

"Process JSON response" option

For advanced use, the Webhook element can also read and process the response returned by the HTTP call.

This allows you, for example, to generate custom responses from data on your own servers. These answers can contain text messages, images, videos, audios, variables, buttons, etc …

Here are some examples of use:

  • Retrieve your latest news automatically without having to integrate them daily "by hand" in your chatbot.
  • Send the collected city or GPS coordinates of a user to your webhook, which in response sends back a message containing the weather to 7 days + a picture of the weather generated by your system.
  • Send to your webhook an order reference of a user collected by the chatbot, which sends back in response the status of the delivery and changes the variables of the user.
  • Send the title of a movie requested by the user in your chatbot to your webhook who connects to your database of millions of videos to send him a trailer without having to pre-program and upload it in your chatbot! 

Your webhook must answer in a few seconds (10 s max - mandatory), beyond this the connection to the webhook will be interrupted and the possible answer canceled.

Your bot will be waiting until your webhook has delivered a response, so make sure your server has a good connection and quick bases.

 If you're going to retrieve non-personalized (news) or reusable content for multiple users (same-city weather), you can cache your answer to increase processing speed and limit calls to your webhook. The duration can be from a few minutes to several days.

 You can use services like Zapier or IFFT that have pre-available webhooks connected to many external APIs like Salesforce, Mailchimp, Google etc ...

 The service will have to send a reply in JSON format and encoded in UTF-8. Recommended content-type header: "application / json"

 Any response must be formatted as follows:

 

{

    "botnation": "v1", // mandatory for the answer to be taken into account

    "reply": [

         // content of the answer (see the many examples below)

              {

                        "type": "text",

                        "value": "Hello"

                } 

    ]

}

 

We highly recommend using the https://jsonlint.com/ service to check the syntax and format of your JSON replies. It is not uncommon to forget a comma or a hug, the answer would be canceled.

Warning: the answer must only contain the JSON file, nothing before or after.

The table "reply [ ]" of the JSON can contain elements of different types (texts, images, buttons ...) in a single answer.

 

 

Text

Displays a simple text.

 

Example:

 

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello World!"

                } 

        ]

}

 

Outcome :

In the value of a text you can inject variables in the same way as for the Text elements of the interface. To do this, circle your variable like this: {{variable}}. 

To learn more about the variables see this article: http://help.botnation.ai/help-in-english/botnation-advanced/get-to-know-everything-there-is-about-variables

 

Example:

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello {{FIRSTNAME}} !"

                } 

        ]

}

 

 

A delay between 2 elements

 "value": duration in seconds.

Example:

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello World!"

                },

                {

                        "type": "delay",

                        "value": 5             

                },

                {

                        "type": "text", 

                        "value": "how are you?" 

                }

        ]

}

 

 

Image, Video or Audio

Displays media ( recommended formats: JPEG for images, MP4 for video, MP3 for audio).

"type" : "image", "video" or "audio"
 "value" : "url of the media" 

 

Example:

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello World!"

                },

                {

                        "type": "image",

                        "value": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/db/Nasa_blue_marble.jpg/250px-Nasa_blue_marble.jpg"

                }

        ]

}

 

Outcome :

Set of Variables

Allows you to assign a value to a user variable.

"name": "name_of_variable" (without space or special character)
"value": "string or value"

In the bot call this variable by {{variable_name}}.

You can create a new variable via this call, however the interface will eventually ask you to validate this variable so that it appears later in the interface menus.

 To learn more about the variables see this article:
http://help.botnation.ai/help-in-english/botnation-advanced/get-to-know-everything-there-is-about-variables

Example:

 

{

        "botnation": "v1",

        "reply": [

                {

                        "type": "set",

                        "name": "who",

                        "value": "World"

                },

                {

                        "type": "text",

                        "value": "Hello {{who}}"

                }

        ]

}

 

Outcome :

for global variables {{%% varglob %%}} the syntax is: "type": "set_gobal"

 

Example:

 

{

        "botnation": "v1",

        "reply": [

                {

                        "type": "set_gobal",

                        "name": "phone",

                        "value": "+33175757575"

                },

                {

                        "type": "text",

                        "value": "Hello {{%%phone%%}}"

                }

        ]

}

 

Buttons and Quick Replies

Displays a list of buttons.

 

To display the buttons of a Button’s Story (3 buttons maximum):

{

    "type": "button",

    "value": "le texte à envoyer"

    "buttons": [button1, button2, button3]

}

 

To display the buttons of a Quick Replies’ Story (11 buttons maximum with icon):

 

{   

    "type": "quickreply",    

    "value": "le texte à envoyer"    

    "buttons": [button1, button2, button3]

}

 

Each of these buttons contains a next field that will redirect the user to a desired sequence. In this field, you must enter a redirection keyword that you defined in the AI module.

 

Buttons: Text with Redirection

Example:

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello!"

                },

                {

                        "type": "button",

                        "value": "Where is Brian?",

                        "buttons": [{

                                        "label": "In the kitchen",

                                        "type": "payload",

                                        "next": "kitchen"

                                },

                                {

                                        "label": "In the bathroom",

                                        "type": "payload",

                                        "next": "bathroom"

                                }

                        ]

                }

        ]

}

 

Outcome :

 

Buttons: Variable Set and Redirection

 
Example:

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello!"

                },

                {

                        "type": "button",

                        "value": "What do you want to eat?",

                        "buttons": [

                                {

                                        "label": "A sandwich!",

                                        "type": "input",

                                        "name": "eat",

                                        "value": "sandwich",

                                        "next": "confirmation"

                                },

                                {

                                        "label": "A Cheeseburger ;)",

                                        "type": "input",

                                        "name": "eat",

                                        "value": "burger",

                                        "next": "confirmation"

                                }

                        ]

                }

        ]

}

 

 

Buttons: Web Site Opening and Telephone Call Launch

The ratio of the open webview may be: "compact", "tall" or "full"

The phone number must start with the country code. (+1 (USA), +33 (France), +48 (Poland) etc.)

  

Example:

{

        "botnation": "v1",

        "reply": [

                {

                        "type": "button",

                        "value": "Google or Phone Call?",

                        "buttons": [{

                                        "label": "Google",

                                        "type": "web_url",

                                         "ratio": "full",

                                        "url": "https://google.com"

                                },

                                {

                                        "label": "Call Me",

                                        "type": "phone_call",

                                        "value": "+33101010101"

                                }

                        ]

                }

        ]

}

 

Quick Replies with Geolocation.

Only on Facebook Messenger

 

Example:

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello!"

                },

                {

                        "type": "quickreply",

                        "value": "Where are you?",

                        "buttons": [{

                                        "label": "Geolocation!",

                                        "type": "location",

                                        "next": "confirmation"

                                }]

                }

        ]

}

 

Outcome :


Quick Replies with Variable Set and Redirection and icon ("url")

 

Example:

{

        "botnation": "v1",

        "reply": [{

                        "type": "text",

                        "value": "Hello!"

                },

                {

                        "type": "quickreply",

                        "value": "What do you want to eat?",

                        "buttons": [{

                                        "label": "A Pizza",

                                        "url": "https://png.icons8.com/dusk/540/shopping-cart.png",

                                        "type": "payload",

                                        "next": "pizza"

                                },

                                {

                                        "label": "A Cheeseburger",

                                        "url": "https://png.icons8.com/dusk/540/shopping-cart.png",

                                        "type": "payload",

                                        "next": "burger"

                                },

                                {

                                        "label": "A Salad",

                                        "url": "https://png.icons8.com/dusk/540/shopping-cart.png",

                                        "type": "input",

                                        "name": "eat",

                                        "value": "salad",

                                        "next": "confirmation"

                                }

                        ]

                }

        ]

}

 

Outcome :

On Botnation's "Web" module it is also possible to indicate outgoing links.

Example:

                                {

                                        "label": "My Website",

                                        "url": "https://png.icons8.com/dusk/540/shopping-cart.png",

                                        "type": "web_url",

                                        "web_url": "https://botnation.ai",

                                        "ratio": "full"                                        

                                }

 

Generate a carousel

 

The carousels can contain several pages and several buttons, each page can have an image or not. The syntax of the buttons are similar to the classic buttons (see above).

The image ratio must be declared in the header. "horizontal" or "square".

Example of a 3-page carousel, the third of which does not contain an image with several button variants.

  

Example:

{

"botnation": "v1",

"reply": [{

"type": "carousel",

"ratio": "horizontal",

"pages": [{

"title": "Where is Brian?",

"subtitle": "in the kitchen",

"image": "https://i.pinimg.com/474x/c7/9b/2b/c79b2b537242b865188f172b346af5fc.jpg",

"link": "https://www.botnation.ai",

"buttons": [{

"label": "In the kitchen",

"type": "redirect",

"next": "kitchen"

}, {

"label": "Call Brian",

"type": "phone_call",

"next": "+33140506010"

}]

}, {

"title": "Hello {{FIRSTNAME}}",

"subtitle": "Powered by Botnation",

"image": "https://cdn.searchenginejournal.com/wp-content/uploads/2017/05/bing-site-search-760x400.png",

"link": "https://www.botnation.ao",

"buttons": [{

"label": "Tell me more...",

"type": "redirect",

"next": "more"

}, {

"label": "Start {{LASTNAME}}",

"type": "web_url",

"url": "https://uplike.com"

}]

}, {

"title": "One more time",

"subtitle": "no picture?",

"buttons": [{

"label": "Test Input",

"type": "input",

"name": "MyVar",

"value": "1234",

"next": "next_one"

}]

}]

}]

}

 

We highly recommend using the https://jsonlint.com/ service to check the syntax and format of your JSON replies. It is not uncommon to forget a comma or a hug, the answer would be canceled.

Did this answer your question?