> For the complete documentation index, see [llms.txt](https://docs.rapidbott.com/help-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rapidbott.com/help-center/tools/tools/inbound-webooks.md).

# Inbound Webooks

An inbound webhook is a useful tool for a chatbot that allows it to receive data from different sources using a POST request. This means that the chatbot can communicate with people who have never interacted with it before.

For instance, when a website visitor provides their contact details, the chatbot can receive the information through an inbound webhook and send an SMS confirmation to the visitor's phone number. If the webhook is integrated into a Voice bot, it can even call the visitor immediately.

A key benefit of using inbound webhooks is that it allows the chatbot to communicate with users seamlessly, improving customer engagement and response times.

{% hint style="info" %}
Rate limit is 500 request per 24 hours. If you require more, reach out to our support.
{% endhint %}

{% embed url="<https://youtu.be/3B8eg8orotM?si=uEiHZ8lkwwLZN-Vy>" %}

### Create an Inbound Webhook <a href="#create-inbound-webhook" id="create-inbound-webhook"></a>

To create an inbound webhook navigate to the Tools tab in your flow builder then select inbound webhook.&#x20;

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FV2rOG2eIH2G3jveuUEDe%2Fimage.png?alt=media&amp;token=83f59871-2698-4522-8c20-aa2b6b5dcb83" alt=""><figcaption></figcaption></figure>

From here click the + New Inbound Webhook button to the right of the dashboard. Next add a memorable name. Now you will see a new window as shown below or by clicking the edit button. This is where you add all the data.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FCctl28bfNfNaCrzvOi4l%2Fimage.png?alt=media&amp;token=29f52207-90b9-44cc-8850-63c6f387122f" alt=""><figcaption></figcaption></figure>

Follow these exact steps to get set up correctly.&#x20;

First you need to **copy the webhook URL** and then **click Listen to payload data** and add the webhook URL to the software where you want to get data from. In our example we will be using a website builder.&#x20;

When you click the **Listen to payload data**, this window will display. This means that the webhook is waiting for some data.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FWPf4wHDOucpmuiRfb5yB%2Fimage.png?alt=media&amp;token=c683ead6-4d24-4062-a227-838a8940f1ba" alt=""><figcaption></figcaption></figure>

Now once we have copied the **webhook url** and clicked **listen to payload data**, let's head over to <https://reqbin.com/> and paste the webhook url into place.

Reqbin has a very easy webhook set up process. **Paste in the Webhook URL** and a sample Json. In this example we are manually trigger a chatbot flow. Your events could be anything depending on your platform of choice.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FsLJxFj9AseULSmZkOceH%2Fimage.png?alt=media&amp;token=ace74a8c-fb3e-4a55-8172-4d5d4a19d032" alt=""><figcaption></figcaption></figure>

The next step is to run a live test. The means we need to make a booking so that the information can be sent to Rapidbott.&#x20;

Once you have run the test head back to the Rapidbott and **click on Done** and now you will see the Json Payload from the test booking we just made.&#x20;

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FhWjO35KV376QbQIaA6sD%2Fevent%20data.png?alt=media&amp;token=232d3a45-5e60-4ed6-8ab2-3cfba657bbc0" alt=""><figcaption></figcaption></figure>

Now that we have data in the sample json payload box, select the green button 'Preview Payload' this will move all the data down so we can use it. Once pressed you will see that the data has been added to the sample data area.

### Json Path Mapping

Whenever the webhook receives data, it first checks the paths you specify to see whether it can find an existing user in the chatbot.

If the user is not in the system, then chatbot will create a new profile. That's how the chatbot initiates a conversation without talking to the user previously.

However, some channels don't allow the chatbot to start the conversation first due to privacy and spam issues.

For example, your SMS bot can send messages as long as you have the recipient's phone number, while your Facebook Messenger chatbot cannot send messages to a Facebook user who never talked to your bot before.

### **Process for User Identification**

This is the process of how the system identifies a user:

At least one of the `User Ns`, `Crm Contact Id`, `Phone` and `Email` should be sent in the payload.

1. If `User Ns` has value, return bot user if matched, stop process if no match.
2. If `Crm Contact Id` has value, return bot user if matched, otherwise continue next check.
3. If `Phone` is valid, return bot user if matched. otherwise new bot user will be created under  channel
4. If `Phone` is not valid, but `Email` is valid, return bot user if `Email` matched , otherwise new bot user will be created with valid `Email`

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FS7nzih2iFEVxpCC7XVjg%2Fsamp.png?alt=media&amp;token=c1c0f699-d1b8-4569-8024-c7956c48d291" alt=""><figcaption></figcaption></figure>

### Add user data to path mapping

To add your data values to the path mapping you need to get the path value from the sample data below. In this example we will just get the email address.

1. Select the contacts email field
2. Copy the JSON path data
3. Paste the JSON path data into the email field

{% hint style="info" %}
If you are just adding phone numbers, then search for the contacts phone number field and repeat the same process.
{% endhint %}

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FrC1SwjdCtjD1z8jZBoJh%2Fget%20sample.png?alt=media&amp;token=621f1c1b-4ab1-40ad-a677-de0ea8882753" alt=""><figcaption></figcaption></figure>

### Storing the users data

Now we want to store the contacts data so we can use it later on, or in this example we're sending a booking confirmation message. At the bottom in the sample data area, you can store all information into a json variable or take specific parts of the data for example, the booking start date, Name and any other information you think you may need.&#x20;

First select the data you want to store. In this example we want to store when the contacts meeting is booked for and their full name.

1. Select the data point: example, Start
2. Create or select a custom field you want to save the data to
3. Click add, once you click add the information will be added to the bottom.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FNqlUMFdDI076GlO4BTkw%2Fsave%20pauloa.png?alt=media&amp;token=cfa9fc34-265e-4d32-9811-3a00e3961315" alt=""><figcaption></figcaption></figure>

Great, that's all the hard work done! Now click save and now we want to add the flow that will be sent to a contact upon booking a meeting with us.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FGrapGpXY8R05P4Sw6x0j%2FWhatsApp%20Image%202024-01-01%20at%2013.08.51_9afe0957.jpg?alt=media&amp;token=1ab78e96-6c49-40c0-9419-061df8ea8e16" alt=""><figcaption></figcaption></figure>

Once you have your flow connected, be sure to make the inbound webhook active, by turning it on.

Now you are ready to run a live test to ensure everything is working ok. If you do get any errors, or something didn't work - Check the logs, this will tell you if anything went wrong.&#x20;

<div align="left"><figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FRu75XAvV4gSh6H2jfUI3%2Fweb%20logs.png?alt=media&amp;token=1e68b450-9188-45df-b4ac-82bf2d4c18a0" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
If you experience any further issues, check the data first - check the flows and ensure you have the right data selected in the json sample data. If you still have issues, let us know and we can assist.
{% endhint %}

### How to debug inbound webhook max request error <a href="#how-to-debug-inbound-webhook-max-request-error" id="how-to-debug-inbound-webhook-max-request-error"></a>

First of all, if you are not receiving the data in the inbound webhook, or you can’t find the data in the logs, it’s highly possible that you reached the max daily request limits.

Here is how you can test it.

You can send the request to the inbound webhook from Postman or Rapidbott external request, and then you can find the below information in the header:

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2Fc92a3pow7jh754T17Ex1%2FUntitled.png?alt=media&amp;token=b2e3e587-8ce6-449d-a168-ebc9b2d41526" alt=""><figcaption><p>Postman Reference</p></figcaption></figure>

As you can see, there is rate-limit-remaining, if it’s 0, that means you already reached the rate limits, you should upgrade for more limits.

You can test this same using the Rapidbott External request.

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FLbO5thXOB5VsMFt9yKMi%2FHeader%201.png?alt=media&amp;token=29a275b0-a745-44b8-a380-c21e64db0f3a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2144409983-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHbDmB8MlZRo4hzrDiO0X%2Fuploads%2FbtvtWcRtpLfODxB4Kd0S%2FHeader%202.png?alt=media&amp;token=d8bf5db7-bd5f-4c7e-a619-6fe8561eebd2" alt=""><figcaption></figcaption></figure>

{% embed url="<https://docs.rapidbott.com/help-center/bot-add-ons/bot-add-ons#inbound-webhook-limits>" %}
