# WhatsApp Cloud API

## Set up

To set up the integration of your assistant in WhatsApp Cloud API, you will need the following:

* A Facebook account registered in the [developers console](https://developers.facebook.com/).
* A Facebook page connected to Meta Business.
* An available phone number.

### Create a Meta app

1. Access the [Facebook developers console](https://developers.facebook.com/apps/).
2. Click on 'Create application', select 'Other', and then click on 'Continue'.\
   ![](/files/e1siyE5ycXJScl7XSut5)
3. Select 'Business' in the next step.\
   ![](/files/Cdg7Skg5oX22ZTttZ4YV)
4. In the form, fill in all fields and click on 'Create application'.\
   ![](/files/V8mCGCHFC3hknVdBDxDX)
5. Access the application you just created, go to the 'Dashboard' section, find the WhatsApp module, and click on 'Configure'.\
   ![](/files/ssPT5Bpm6UOq0E73EPBe)
6. Select your Meta Business account or click 'Create a business account' to continue.\
   ![](/files/e2IRaZEdz7ocVvAPywZx)

### Add your phone number

1. Go to the **WhatsApp** > **Quickstart** menu section.
2. In step 5, click on 'Add a phone number', fill in the details, and validate the link with the WhatsApp Business API account through the confirmation SMS.\\

### Generate a Permanent Access Token

1. Navigate to [Facebook Business](https://business.facebook.com/).
2. From the side menu, select **Users** > **System Users**.\
   ![](/files/LqhlbMJrS0gGSLKUy77m)
3. Add a new user with administrator privileges.\
   ![](/files/A5uLsvBzy7OifzxEs6vG)
4. In the side menu, go to **Accounts** > **WhatsApp Accounts**.\
   ![](/files/ArnIlBM5AJj8y1Z3sRMR)
5. Grant full control permissions to the newly created user.\
   ![](/files/fPLNXXBbDl7ZOpieIaf8)
6. Return to the **System Users** section and click on **Assign Assets**.\
   ![](/files/4Ot4HM1C4wSRuRxAeIxr)
7. Choose the desired application and assign admin permissions.\
   ![](/files/46Ea48CbGNk8ScvwerQV)
8. Once saved, click on **Generate New Token**.\
   ![](/files/xaSwn0dXYzg7yjxoEWEm)
9. Select the application, set the expiry to **Never**, and enable WhatsApp permissions.\
   ![](/files/hnLBgloa7C1ld7ZpAuV3)
10. Copy the generated authentication token for future use.

### Obtain the Phone Number ID

1. Navigate to [Facebook developers console](https://developers.facebook.com/apps/).
2. Access to the created application.
3. Go the **WhatsApp** > **Quickstart** menu section.
4. Select the linked phone and copy the ID displayed below it (Phone Number ID).\
   ![](/files/z4NLfXRop5ZNuXSIUzDo)

### Obtain the application secret key

1. Navigate to [Facebook developers console](https://developers.facebook.com/apps/).
2. Access to the created application.
3. Go the **Settings** > **Basic Information** menu section.
4. Click show and copy the application secret key.\
   ![](/files/NsJWBmjayiJ8KkkYUOIR)

### Connect your app with your assistant

#### Activate integration in 1millionbot platform

1. Go to the **Channels** section on the platform.
2. Activate WhatsApp and click on 'Settings'.
3. Enter the previously obtained data: Application Secret Key, Permanent Access Token and Phone Number ID
4. Click on 'Save'.\
   ![](/files/CqUr9UBmnbhTnw97F955)

#### Activate integration in Meta

**Obtain the Callback URL**

1. Go to the 1millionbot platform and click on the 'Info' button in the WhatsApp Cloud channel to get the callback URL.\
   ![](/files/XUFQSmyOo2oQ61df7qp3)

**Configure the Meta Webhook**

1. In the **WhatsApp** > **Settings** menu section of the Meta developers console, click on 'Edit' in the **Webhook** section.\
   ![](/files/QMjYFmXpDC2b8E8yc0q0)
2. Paste the callback URL obtained from the 1millionbot platform and enter the Permanent Authentication Token.
3. Click 'Save' to apply the changes.

### Set permissions

1. In the **WhatsApp** > **Settings** menu section, click on 'Manage' to activate the necessary Webhook permissions:\
   \- *messages*\
   ![](/files/t7KRL7erRk95It4Spxgi)
2. Click 'Save' to apply the changes.

### Publish Meta app

1. Now, your application is in development mode, so you can test the assistant's operation as long as the phone number you use to interact with the assistant belongs to one of the users with access to the application.
2. To publish the assistant for public interaction, change the mode from development to production and provide all the necessary information (found at the top of the Meta developer console).\
   ![](/files/OMNO88bVLq81Hg2s8qGL)
3. Done! Once published, perform tests to verify the operation of your assistant on the provided phone number in WhatsApp. 🎉

## Limitations

* Initial limit of 1000 conversations per day ([+ info](https://developers.facebook.com/docs/whatsapp/messaging-limits)).
* Maximum of 3 buttons per message.
* Each button can have a maximum of 20 characters.


---

# 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.1millionbot.com/chatbot/channels/whatsapp-cloud-api.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.
