> For the complete documentation index, see [llms.txt](https://docs.botdistrikt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.botdistrikt.com/messaging-channels/whatsapp/twilio.md).

# Twilio WhatsApp Integration

By integrating Twilio WhatsApp API, the platform allows your bot to respond to WhatsApp messages directly, and automate customer care, sales, support, and other business functions.

## Prerequisites

For the Twilio WhatsApp API Provider, we will need

* An Account SID&#x20;
* Auth Token
* A WhatsApp-enabled Number

When a user sends a message to your WhatsApp Enabled Number, your BotDistrikt bot will reply to them

### Create a Twilio Account

You can set up a new Twilio Account [here](https://www.twilio.com/try-twilio). After logging in for the first time and setting up your details, you will be taken to the Dashboard page.&#x20;

You will get your Account SID and the Auth Token from this page

{% hint style="success" %}
New accounts come with $15 worth of credits, which you can use to purchase a phone number
{% endhint %}

<figure><img src="/files/eFYXjjO8N1DIdhezLIen" alt=""><figcaption><p>Twilio Console </p></figcaption></figure>

### Enable the WhatsApp Sandbox

Click on the **Messaging** tab and click on **Overview > Try WhatsApp**

<figure><img src="/files/NxBsmiTO3JtrLsjgEp00" alt=""><figcaption><p>Twilio WhatsApp Sandbox</p></figcaption></figure>

Follow the instructions on this page

When your device is connected to the Sandbox, you will receive this message

<figure><img src="/files/1oArGt24yqYUGN6qHsMF" alt="" width="375"><figcaption></figcaption></figure>

After you have successfully completed the above steps, return to the **Twilio  Messaging  > Try WhatsApp**. You will see this step.

<figure><img src="/files/V0UytxlYKgLlS1LFfWf7" alt=""><figcaption></figcaption></figure>

You are now ready to setup the Twilio WhatsApp API Provider on your BotDistrikt WhatsApp channel

## Setup

<figure><img src="/files/wHv4UJnJ2fzHWeIekJPQ" alt=""><figcaption><p>BotDistrikt WhatsApp Integration</p></figcaption></figure>

We have our Account SID and Auth Token ready. We need to get the WhatsApp Enabled Number ready now.

On Twilio, click **Sandbox Settings** to get your WhatsApp Enabled Number.

<figure><img src="/files/UvbNCKYRodaSteglukpC" alt=""><figcaption></figcaption></figure>

On BotDistrikt, fill in all 3 fields:

* An Account SID&#x20;
* Auth Token
* A WhatsApp Enabled Number

{% hint style="info" %}
For the WhatsApp Enabled number, make sure to remove the white spaces and add a **whatsapp:** prefix.&#x20;

For example, if the number you copy from Twilio is `+1 415 523 8886`, The number you will need to key into BotDistrikt is `whatsapp:+14155238886`&#x20;
{% endhint %}

<figure><img src="/files/k6XMNqlFVyiS2s6XJIqB" alt=""><figcaption></figcaption></figure>

Click **Link to WhatsApp**

When it is linked, take note of the **When A Message Comes In** and **Status Callback** endpoint URLs

<figure><img src="/files/k6DfXz23MgloStYGc1vS" alt=""><figcaption></figcaption></figure>

Go Back to **Twilio**&#x20;

Click **Settings > WhatsApp Sandbox Settings** and paste the respective endpoint URLs there

<figure><img src="/files/mbEizfxYF0h9NLReMVUK" alt=""><figcaption></figcaption></figure>

Click **Save** on Twilio

Your BotDistrikt bot is now connected to WhatsApp through Twilio!

<figure><img src="/files/y6DUnJR0oanFopBqFPAT" alt="" width="375"><figcaption><p>Whatsapp Chatbot Connected</p></figcaption></figure>
