# Webhooks Setup

{% hint style="info" %}
WhatsApp Business Blog

* [Using Node.js to implement webhooks](https://business.whatsapp.com/blog/how-to-use-webhooks-from-whatsapp-business-api)
  {% endhint %}

### Create an Endpoint <a href="#create-an-endpoint" id="create-an-endpoint"></a>

Before you can start receiving notifications you will need to create an endpoint on your server to receive notifications.

Your endpoint must be able to process two types of HTTPS requests: Verification Requests and Event Notifications. Since both requests use HTTPs, your server must have a valid TLS or SSL certificate correctly configured and installed. Self-signed certificates are not supported.

[Learn more about Verifying Requests and Event Notifications ![](https://scontent.fcgk6-2.fna.fbcdn.net/v/t39.2365-6/276034258_1045248339390233_3876773921429146148_n.png?_nc_cat=110\&ccb=1-7&_nc_sid=e280be&_nc_ohc=tW-6it9FyVUAX828zvF&_nc_ht=scontent.fcgk6-2.fna\&oh=00_AfDqrtzIZtqJXtyTutN809hpYx1Oy4yHPtQ8FyYFj62JyA\&oe=65711D75)](https://developers.facebook.com/docs/graph-api/webhooks/getting-started#create-endpoint)

{% hint style="info" %}
Webhooks set up will not affect the phone number on your WhatsApp Business App. Only after you [migrate your number over to the WhatsApp Business Platform](https://developers.facebook.com/docs/whatsapp/overview/phone-number#migrate) can you no longer use that number on your WhatsApp Business App.
{% endhint %}

### Subscribe to Webhooks <a href="#subscribe-to-webhooks" id="subscribe-to-webhooks"></a>

To subscribe to Webhooks, you will need to get a Meta App ID and permissions. To do this go to the Meta App Dashboard. There you will:

1. [Create a Business Type App in the Meta App Dashboard ![](https://scontent.fcgk6-2.fna.fbcdn.net/v/t39.2365-6/276034258_1045248339390233_3876773921429146148_n.png?_nc_cat=110\&ccb=1-7&_nc_sid=e280be&_nc_ohc=tW-6it9FyVUAX828zvF&_nc_ht=scontent.fcgk6-2.fna\&oh=00_AfDqrtzIZtqJXtyTutN809hpYx1Oy4yHPtQ8FyYFj62JyA\&oe=65711D75)](https://developers.facebook.com/docs/development/create-an-app)
2. [Add the Webhooks Product to your Meta app in the App Dashboard ![](https://scontent.fcgk6-2.fna.fbcdn.net/v/t39.2365-6/276034258_1045248339390233_3876773921429146148_n.png?_nc_cat=110\&ccb=1-7&_nc_sid=e280be&_nc_ohc=tW-6it9FyVUAX828zvF&_nc_ht=scontent.fcgk6-2.fna\&oh=00_AfDqrtzIZtqJXtyTutN809hpYx1Oy4yHPtQ8FyYFj62JyA\&oe=65711D75)](https://developers.facebook.com/docs/graph-api/webhooks/getting-started#configure-webhooks-product)

{% hint style="info" %}
At any time, each Meta App can have only one endpoint configured. If you need to send your webhook updates to multiple endpoints, you need multiple Meta Apps.
{% endhint %}

If you are a Solution Partner, you may need to:

1. [Add the `whatsapp_business_messaging` permission ![](https://scontent.fcgk6-2.fna.fbcdn.net/v/t39.2365-6/276034258_1045248339390233_3876773921429146148_n.png?_nc_cat=110\&ccb=1-7&_nc_sid=e280be&_nc_ohc=tW-6it9FyVUAX828zvF&_nc_ht=scontent.fcgk6-2.fna\&oh=00_AfDqrtzIZtqJXtyTutN809hpYx1Oy4yHPtQ8FyYFj62JyA\&oe=65711D75)](https://developers.facebook.com/docs/development/create-an-app/app-dashboard#app-review) in your App Dashboard
2. [Successfully complete Meta App Review ![](https://scontent.fcgk6-2.fna.fbcdn.net/v/t39.2365-6/276034258_1045248339390233_3876773921429146148_n.png?_nc_cat=110\&ccb=1-7&_nc_sid=e280be&_nc_ohc=tW-6it9FyVUAX828zvF&_nc_ht=scontent.fcgk6-2.fna\&oh=00_AfDqrtzIZtqJXtyTutN809hpYx1Oy4yHPtQ8FyYFj62JyA\&oe=65711D75)](https://developers.facebook.com/docs/app-review) – This step will take time but you can continue to test during the entire review process.

### Understanding Webhooks <a href="#understanding-webhooks" id="understanding-webhooks"></a>

Whenever a trigger event occurs, the WhatsApp Business Platform sees the event and sends a notification to a Webhook URL you have previously specified. You can get two types of notifications:

* **Received messages**: This alert lets you know when you have received a message. These can also be called "inbound notifications" throughout the documentation.
* **Message status and pricing notifications**: This alert lets you know when the status of a message has changed —for example, the message has been read or delivered. These can also be called "outbound notifications" throughout the documentation.

All Webhooks have the following generic format:

```
{
  "object": "whatsapp_business_account",
  "entry": [{
      "id": "WHATSAPP_BUSINESS_ACCOUNT_ID",
      "changes": [{
          "value": {
              "messaging_product": "whatsapp",
              "metadata": {
                  "display_phone_number": "PHONE_NUMBER",
                  "phone_number_id": "PHONE_NUMBER_ID"
              },
              # specific Webhooks payload            
          },
          "field": "messages"
        }]
    }]
}
```

See [Components](https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components) for information on each field.

{% hint style="info" %}
If you receive a message that is not supported for Cloud API, you will get an [unknown message webhook](https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/payload-examples#unknown-messages).
{% endhint %}

#### Payload Size <a href="#payload-size" id="payload-size"></a>

Webhooks payloads can be up to 3MB.

### Sample App Endpoints <a href="#sample-app-endpoints" id="sample-app-endpoints"></a>

Create a sample app endpoint to test your webhooks.

* [Sample App Endpoints using Glitch ![](https://scontent.fcgk6-2.fna.fbcdn.net/v/t39.2365-6/276034258_1045248339390233_3876773921429146148_n.png?_nc_cat=110\&ccb=1-7&_nc_sid=e280be&_nc_ohc=tW-6it9FyVUAX828zvF&_nc_ht=scontent.fcgk6-2.fna\&oh=00_AfDqrtzIZtqJXtyTutN809hpYx1Oy4yHPtQ8FyYFj62JyA\&oe=65711D75)](https://developers.facebook.com/docs/whatsapp/cloud-api/guides/sample-app-endpoints)
* [Sample App Endpoints using Heroku ![](https://scontent.fcgk6-2.fna.fbcdn.net/v/t39.2365-6/276034258_1045248339390233_3876773921429146148_n.png?_nc_cat=110\&ccb=1-7&_nc_sid=e280be&_nc_ohc=tW-6it9FyVUAX828zvF&_nc_ht=scontent.fcgk6-2.fna\&oh=00_AfDqrtzIZtqJXtyTutN809hpYx1Oy4yHPtQ8FyYFj62JyA\&oe=65711D75)](https://developers.facebook.com/docs/graph-api/webhooks/sample-apps)

### Webhook Delivery Failure <a href="#webhook-delivery-failure" id="webhook-delivery-failure"></a>

If we send a webhook request to your endpoint and your server responds with an HTTP status code other than 200, or if we are unable to deliver the webhook for another reason, we will keep trying with decreasing frequency until the request succeeds, for up to 7 days.

Note that retries will be sent to all apps that have subscribed to webhooks (and their appropriate fields) for the WhatsApp Business Account. This can result in duplicate webhook notifications.

### IP Addresses <a href="#ip-addresses" id="ip-addresses"></a>

You can get the IP addresses of our webhook servers by running the following command in your terminal:

```
whois -h whois.radb.net — '-i origin AS32934' | grep ^route | awk '{print $2}' | sort
```

We periodically change these IP addresses so if you are allow-listing our servers you may want to occasionally regenerate this list and update your allow-list accordingly.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.is-messenger.com/ismessenger/messaging-channels/whatsapp/whatsapp-cloud-api/webhooks-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
