# WhatsApp business API

*In this article, we will tell you how to connect the WhatsApp Business API (WABA) channel.*

To connect, you will need:

* Personal account [Facebook](https://facebook.com/)\*.
* Access to a registered [Facebook Business Manager account](https://business.facebook.com/)\*.
* A phone number connected to WhatsApp Business. The number must be active and able to receive calls and SMS.

{% hint style="warning" %}
Before connecting, make sure there are no issues with your [Facebook advertising account](https://business.facebook.com/business-support-home/)\*.
{% endhint %}

## Preparation for connection

Before connecting WABA, check that your website meets Meta\* requirements.

For successful verification, the website footer must contain:

* **A link to the privacy policy or personal data processing policy.** It is important that there is a clause stating that you may send newsletters to clients and clients can unsubscribe from them. The wording may be different.

<details>

<summary>Example wording</summary>

The company has the right to send the user notifications about new products and services, special offers, and various events. The user can opt out of receiving messages by sending a letter to the company at <mail@gmail.com> with the note «Unsubscribe from notifications».

</details>

* **The legal name of the company.** It must match the one specified in the Meta\* business portfolio in [Facebook\* Business Manager](https://business.facebook.com/select/?next=https%3A%2F%2Fbusiness.facebook.com%2Fsettings%2Finfo\&ext=1719569849\&hash=Afngqy8QoolXzCGMaaQBWbLfDhtLbwAUI1OPQL39uJC48w). A mismatch will result in account blocking.
* **Legal address.** It must also match the one specified in the Meta\* business portfolio in [Facebook\* Business Manager](https://business.facebook.com/select/?next=https%3A%2F%2Fbusiness.facebook.com%2Fsettings%2Finfo\&ext=1719569849\&hash=Afngqy8QoolXzCGMaaQBWbLfDhtLbwAUI1OPQL39uJC48w). A mismatch will result in account blocking.

{% hint style="warning" %}
Be sure to check all the points described above, otherwise your account may be blocked!
{% endhint %}

## Connecting WhatsApp Business API

### Step 1. Creating a Meta\* for Developers account

1. Go to the [Meta\* for developers page](https://developers.facebook.com/).
2. In the top menu, click «*Get Started*».
3. Click «*Continue*».
4. Enter your phone number.
5. Enter the code from the SMS. Click «*Continue*».
6. Enter your email address.
7. Check the box to agree to receive newsletters and click «*Send Email*».
8. In the window that opens, enter the code sent to your email. Click «*Continue*».
9. In the next step, select «*Developer*».
10. Click «*Complete Registration*».

### Step 2. Creating an application

Go to the [page](https://developers.facebook.com/apps/creation/). Select the business portfolio you want to connect the application to, click «*Next*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/AD0gvD7s19zz3Wj0BLjG/sWABA1.png" alt=""><figcaption></figcaption></figure>

In the next step, select «*Other*» section and click «*Next*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/uzBM0YAzKfw8Pa1j23pC/sWABA11.jpg" alt=""><figcaption></figcaption></figure>

Then select the application type «*Company*»*.*

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/D1DJpS1ecjFcCp7PgWFd/sWABA12.png" alt=""><figcaption></figcaption></figure>

Enter the application name and your contact email. Click «*Create Application*»*.*

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/yje8881VHjnIPLsz8j6o/sWABA3.png" alt=""><figcaption></figcaption></figure>

### Step 3. Create a WhatsApp account

In the list of applications, find WhatsApp and click «*Set Up*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/3j5auYWjoHqAL2Xfdg3D/sWABA13.png" alt=""><figcaption></figcaption></figure>

In the drop-down list, select the business portfolio and click «*Continue*»*.*

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/108s7AtYaQ9ZS0oOFMS0/sWABA4.png" alt=""><figcaption></figcaption></figure>

In the opened settings, in the «Messaging»section, click the drop-down list with numbers and select «*+ Add phone number*»*.*

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/jVvyKFnX7aVbELqaEVoz/sWABA21.png" alt=""><figcaption></figcaption></figure>

To add a number, enter the display name, select the time zone and category, optionally add a company description, then click «*Next*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/gnZlfHKJJ0x2NDQlImrz/sWABA22.png" alt=""><figcaption></figcaption></figure>

Enter the phone number, select SMS verification, and click «*Next*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/a125y4bPKDXumnLSUSXk/sWABA23.png" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you see the error «This number is registered to an existing WhatsApp account…», use another number or delete the WhatsApp account linked to this phone number.
{% endhint %}

Enter the verification code from the SMS and click «*Next*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/BQynXCU8vyvnnraFpBRt/sWABA24.png" alt=""><figcaption></figcaption></figure>

After adding the number, save the phone number ID and account ID, you will need them when setting up in your Selarti personal account.

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/HA1NMZGaObfEQsh0M1D8/sWABA38.png" alt=""><figcaption></figcaption></figure>

### Step 4. Connecting the Webhook

In your Meta\* for Developers personal account, in the upper right corner, go to the «[*My Apps*](https://developers.facebook.com/apps)».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/cxbIW01lkoBb9NlS4ahA/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024%2006%2012%20%D0%B2%2009.35.07.png" alt=""><figcaption></figcaption></figure>

Select the created application.

On the left, go to *WhatsApp > Setup*. In the «Webhook» section, click «*Edit*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/xPZUQHbaQzxKkvvQ4i5B/sWABA25.png" alt=""><figcaption></figcaption></figure>

Fill out the form:

* In the «Callback URL» field, paste the link: <https://api.selarti.com/waba>.
* In the «Verify Token» field, enter: selarti\_is\_the\_best\_service.

Click «*Verify and Save*»*.*

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/4NGsYtvmX2UaD02m2gTb/sWABA26.png" alt=""><figcaption></figcaption></figure>

In the same section, click «*Set Up*» to edit the Webhook fields.

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/GPeVZSjLuqNS3rWoTEWc/sWABA27.png" alt=""><figcaption></figcaption></figure>

In the opened window, check the box next to «*messages*»*,* then click «*Done*»*.*

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/4YSvomVxaWQVUX0ExgEw/sWABA28.png" alt=""><figcaption></figcaption></figure>

### Step 5. Creating a system user

In the section «[*Company settings*](https://business.facebook.com/settings/)» go to *Users > System Users* section and click «*Add*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/2wAWSEIpRWt78f7PDXiz/sWABA29.png" alt=""><figcaption></figcaption></figure>

Enter the system user's name, select the role from the drop-down list «Admin» section and click «*Create system user*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/6xDmmePz5qgW7aYmTP9B/sWABA30.png" alt=""><figcaption></figcaption></figure>

### Step 6. Creating an access token

In the section «[*Company settings*](https://business.facebook.com/settings/)» go to *Users > System Users*. Select the previously created user and click «*Create new token*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/ShA3TFTqSeAKi3usGD8J/sWABA31.png" alt=""><figcaption></figcaption></figure>

Select the application from the drop-down list, token expiration, and permissions:

* whatsapp\_business\_management.
* whatsapp\_business\_messaging.

Click «*Generate Token*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/q47K6m4ZEo6XHoATkwEB/sWABA32.jpg" alt=""><figcaption></figcaption></figure>

A window with the token will open. Copy it and click «*OK*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/WFVdM4mOlFwv2PYCSHoj/sWABA33.png" alt=""><figcaption></figcaption></figure>

### Step 7. Connecting payment

In the [company settings](https://business.facebook.com/settings/) go to *Accounts > WhatsApp Accounts*. Select the desired account from the list and click «*Payment Settings*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/qwX3iunBuXOMqwcbqs3N/sWABA34.png" alt=""><figcaption></figcaption></figure>

Select the country, currency, and time zone, click «*Next*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/CnPeO10iaT0tbvOYP1A0/sWABA35.png" alt=""><figcaption></figcaption></figure>

Enter card details, click «*Save*».

<figure><img src="https://content.gitbook.com/content/sBua8zDbkZPvmgjidnwA/blobs/JXRvPpG9eoan1QGopdSM/sWABA36.png" alt=""><figcaption></figcaption></figure>

## Connecting WhatsApp business API in the Selarti dashboard <a href="#podklyuchenie-whatsapp-cloud-api-v-kabinete-chatapp" id="podklyuchenie-whatsapp-cloud-api-v-kabinete-chatapp"></a>

Open your Selarti dashboard, go to the «[***Channels***](https://selarti.com/panel?menu=channels)» section and click «*Add channel*».

<figure><img src="https://271796707-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsBua8zDbkZPvmgjidnwA%2Fuploads%2F6WhEdq9faE9jibxaQM84%2Fwa_25.png?alt=media&#x26;token=76a94583-ca9f-4aa2-ab46-3dfc20d54fb9" alt=""><figcaption></figcaption></figure>

In the drop-down menu, select the channel type «*WhatsApp business API*» and fill in the fields:

* **Service user access token** — token marker from [step 6](#step-6.-creating-an-access-token).
* **WhatsApp phone ID** — phone number ID from [step 3](#step-3.-create-a-whatsapp-account).
* **WhatsApp Business ID** — account ID from [step 3](#step-3.-create-a-whatsapp-account).

Click «*Get Template*»*.*

<figure><img src="https://271796707-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsBua8zDbkZPvmgjidnwA%2Fuploads%2F7ib30IwPKJnG7VKmW640%2Fwa_26.png?alt=media&#x26;token=59f8851f-5e2a-49ca-86da-945ca0fd2a6a" alt="" width="465"><figcaption></figcaption></figure>

Select a template in the field «*Select template*»— for incoming only, you can select the hello\_world template.

For outgoing, you need to create a separate template in your personal account [Meta\* for developers page](https://developers.facebook.com/).

After selecting a template, click «*Add channel*»*.*

<figure><img src="https://271796707-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsBua8zDbkZPvmgjidnwA%2Fuploads%2FcvDWHiBL3fCvFVZ4MOjd%2Fwa_27.png?alt=media&#x26;token=87ccbda2-3b30-4819-a02d-4e6c3074c7e7" alt="" width="465"><figcaption></figcaption></figure>

\*Facebook is owned by Meta\*, which is recognized as an extremist organization in the Russian Federation.
