Advance flow builder: Webhook

Prabhansh Jain Updated by Prabhansh Jain

When can use Webhook in Flow Builder?

Advanced Flow Builder features are an add-on to the regular plan and are charged separately.

By default, this icon is shown with "PRO" logo as below.

This icon can be setup in flow using the normal plan and the flow can be saved successfully. But when we setup to use in Keyword or in Default Action, the system will prompt out popup asking the user to upgrade in order to use these advanced flow builder features

After upgrading WATI to PRO plan, the user can use these advanced flows in Keyword or Default Action.

Meaning and Usage

Webhooks: By webhooks you can retrieve (GET) or send (POST) data from one place to another. Supposedly you having your own database.

To Use This: Simply drag and drop the webhook icon or when you extend the flow select the webhook feature.

Features

  1. URL & Method

This is where you can choose:

  • GET Method
  • POST Method

And your URL endpoint of the external API.

you can also make your URL Dynamic by inserting variables from the variables button shown in the image above.

To add variables, you should always do it in the URL Path.

Example: URL ⟶ https://webhook-wa-testing.clare.ai/16d6942a-64cb-43f3-8e8a-2bddace647f3?name={{name}}

  1. Customize Headers

Headers in HTTP webhook requests are generally used to specify the purpose of this webhook or the content type it contains.

It is completely optional to use headers, and it is by default set as off.

As shown in the above picture, you can set headers as key-value pairs, and then later when you set the request it will be sent in Headers.

Example: key = Content-Type , value = application/x-www-form-urlencoded

so it will be sent as

Content-Type : application/x-www-form-urlencoded

  1. Customize the body

In this you can send information in the body of the webhook request, this is also completely optional and set as off by default.

This is written in JSON format, or else there will be an error.

An example of how the body request should look like:

{

"name" : "@name",

"address" : "@address"

}

  1. Set your test variable

Manually setting your test variables here.

  1. Test the Request

You can test the API request by clicking on 'Test The Request' button.

  1. Save Responses as Variables

You can also save the response of a request as variables whenever you trigger the webhook method.

Now you can either choose to make it a custom attribute or save it as a variable.

If your API response is a json with key-value paid, you can store each of the values by passing the key name.

For example, if you want to store "Hello from Webhook" from this response

You need to store it as below -

Once you do that, you can type in your variable or custom attribute and save the entire response.

  1. Response Routing

You can use response routing in your flow so that whenever a request status matches the expected status it follows the flow according to that.

Example:

200 - Okay Request

400 - Bad Request

Here you can split your flow according to response status codes.

It will show like this in the flow:

Now, you can set up messages following them. Suppose for status = 200, I will send a message saying HTTP Request Succesful.

This is all about your webhook flow feature.

Thanks.

How did we do?

Advance flow builder: Setup Subscribe or Unsubscribe

How to build a flow

Contact