What are Webhooks & How Can They Help You
Chatbot  -  Feb 08, 2018

How are webhooks used?

Have you ever wondered how all of those travel sites get all the flight prices from so many different airlines? Imagine a process where Orbitz representatives are on the phone calling American Airlines, Delta, Jetblue, and requesting the new prices since the last time they called. Then they would take that price and enter into their site so that their end users could book the flight. By the time all of this was done, it’s more likely that prices would have changed again and the information that the user is looking at is no longer accurate. The Solution: Instead of doing all that manual scraping, companies like Orbitz simply send your flight criteria to all the airlines and return the results to their own site, with a webhook using a REST API service.

What are webhooks?

“Webhooks” (WH) is just a way of describing the use of third-party APIs to pull data or content into a site, without changing the overall structure or code. They can be triggered by different events in a site.  (e.g. clicking “Search” in Orbitz).  When triggered, the webhook makes requests to the API it needs to pull data from. Typically included in that request are the criteria or “parameters” that users input, (e.g. Destination: New York, Flight Type: Non-stop). The API passes those criteria to a server where they are processed and sent back with response data. (e.g. 10 flight options from $ - $$$$).  This “conversation” allows a service to pull in data and content from any third party service back to their site without having to scrape data on the web or doing any processing on its own servers.

Webhooks: A Lesson in Lingo

There are a few terms that are important to grasp before describing and understanding how the webhooks process works.

  • API Endpoint: this is the API URL of the 3rd party service that the requests will be sent to. Every API is unique, so It is important that the requests being sent match the expected structure that the API is configured for.

  • Request Parameters: The data values that are sent to the API in order to return the desired response.

  • JSON Response: This is the response returned to the requesting service with information. Responses can come in a variety of formats from JSON to XML or Raw Text.

A very general flow of data is illustrated in the diagram above

A very general flow of data is illustrated in the diagram above

How does Instabot use webhooks?

Recently, we released a webhooks integration tool within our Instabot Builder. This allows you to configure a webhooks for any API you have access to, in order to pull outside data into your bots. This means that your bot doesn’t need to know the answers to all questions before you can ask a user. You can simply pass their responses to a 3rd party API via the WH configuration and receive results just like the aforementioned Orbitz use case.

Bot Example

For example, let's say I wanted to build a bot that provided users with a recipe based on ingredients they already have at home. The conversation could be built so that it asks the user for some information:

  • Name all your ingredients you want to use.

The user’s answer would then be sent to an API which could interpret those ingredients and pass them to a recipe service (the Food2Fork API happens to do just that). The service would then quickly search its database for available recipes that include those ingredients and send the list back to Instabot. The end user could then choose from this list and be directed to full recipes to try or search again with other ingredients.

With webhooks, the possibilities and use cases are endless. You can utilize them to create conversations that are dynamic and react to the user’s needs leading to increased engagement. The beauty is that WH enable any data source that has an API available to be included in your conversation.

Play around with our Recipe bot below and see how we used the Food2Fork API to create a bot that helps you find a meal using ingredients you already have.

Check it out! https://instabotdemo.roko.mobi/wh/nytimes.html

Have any questions about webhooks or how to use them in bots? Just ask. E-mail us at [email protected]

Latest from Instabot
Why Chatbots are the Hottest Trend in SMS Marketing

Why use chatbots with your SMS marketing? SMS marketing brings branded messaging directly to consumers’ pockets, letting shoppers opt in to receive notifications and offers wherever they are. 

Learn More
5 Marketing Ideas to Capture and Convert Customers via Text

When it comes to gaining leads and guiding them toward conversion, there’s more to text messaging that you might expect. With the help of a powerful text messaging chatbot, you can automatically capture, qualify and educate hundreds of prospects at once.

Read on for five actionable ideas for capturing and converting leads via text.

Learn More
Harness the Power of OpenAI with Instabot

Power up your marketing game via OpenAI-powered chatbots. With Instabot’s fully customizable script node, you can fully integrate with OpenAI’s robust API playground. Create bots that can answer general knowledgebase FAQs, correct grammar or passages of grammar, create summaries of longer bodies of text, and more. 

Learn More