> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suprsend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Whatsapp Cloud API

> Integration guide to setup whatsapp notifications on meta using Whatsapp Cloud API.

## Pre-Requisites

**Create Meta Developers account**

* Log in to your Facebook account.

* Click [here](https://developers.facebook.com/) and Get Started.

After completing the verification and accepting terms, you should be able to access [Facebook developers dashboard](<https://developers.facebook.com/apps/?show_reminder=true.&#xA;>)

## Set up WhatsApp business account on Meta

<Steps>
  <Step title="Create/add your business app on meta developers console" icon={1} stepNumber="1">
    On the [developer’s console](https://developers.facebook.com/apps) create an app by clicking on **`Create app`** button, then select **`Other`** on the next screen of "What do you want your app to do?"

    <Frame>
      <img src="https://mintcdn.com/suprsend/JOwfEC79k-vs3tUR/images/docs/821df6e-image.png?fit=max&auto=format&n=JOwfEC79k-vs3tUR&q=85&s=6ef96a99814d36ed5e64038402dca86a" width="1690" height="1156" data-path="images/docs/821df6e-image.png" />
    </Frame>

    Select app type - **"Business"**

    <Frame>
      <img src="https://mintcdn.com/suprsend/JOwfEC79k-vs3tUR/images/docs/9917411-image.png?fit=max&auto=format&n=JOwfEC79k-vs3tUR&q=85&s=129ce08ed21cf377a943dac9fcd87d6a" width="2120" height="1064" data-path="images/docs/9917411-image.png" />
    </Frame>

    Add App name and create app with your personal details

    <Frame>
      <img src="https://mintcdn.com/suprsend/3ix_OjxB_ZGM-pa-/images/docs/172f8b2-Screenshot_2023-07-25_at_8.24.10_PM.png?fit=max&auto=format&n=3ix_OjxB_ZGM-pa-&q=85&s=988ddc0f16f27f1d91cd33a746e2c37f" width="2074" height="930" data-path="images/docs/172f8b2-Screenshot_2023-07-25_at_8.24.10_PM.png" />
    </Frame>
  </Step>

  <Step title=" Setup WhatsApp Cloud API" icon={2} stepNumber="2">
    Now that your app is created you need to add "`WhatsApp`" product, scroll down and click "`Set up`" on WhatsApp. You will be redirected to the WhatsApp get started page, here you can "create a business account" or use an existing one.

    <Frame>
      <img src="https://mintcdn.com/suprsend/dnAGb1CmSRGCSyT3/images/docs/3edcf5f-image.png?fit=max&auto=format&n=dnAGb1CmSRGCSyT3&q=85&s=e47410ef4ba8beb4939cdd2dd050fd79" width="1960" height="994" data-path="images/docs/3edcf5f-image.png" />
    </Frame>

    Click on `Continue`. You'll land on the app dashboard.
  </Step>

  <Step title="Send a test message" icon={3} stepNumber="3">
    On the [App dashboard](https://developers.facebook.com/apps), select "`API Setup`" from the left navigation menu. Here you'll see a **`temporary access token`**, **`Phone number ID`** and a curl to send the message.

    Add your personal phone number in the "to" field to send a test message on your mobile number.

    <Frame>
      <img src="https://mintcdn.com/suprsend/jhGzZpggWCp1KSgu/images/docs/d39b45e-image.png?fit=max&auto=format&n=jhGzZpggWCp1KSgu&q=85&s=607dd6fefad520c054242043dda5ad5f" width="1734" height="1322" data-path="images/docs/d39b45e-image.png" />
    </Frame>

    <Warning>
      The phone\_number\_id is from a Facebook test phone number which cannot be used in production.
    </Warning>
  </Step>

  <Step title="Add a valid business phone number" icon={4} stepNumber="4">
    Scroll down to step 5 on the API page. To add your business phone number, Click on "Add phone number" and add your business information to register the number

    <Frame>
      <img src="https://mintcdn.com/suprsend/jhGzZpggWCp1KSgu/images/docs/ef43950-image.png?fit=max&auto=format&n=jhGzZpggWCp1KSgu&q=85&s=4a2d13524f5b5a8eb9d7de96a0d753fd" width="1710" height="192" data-path="images/docs/ef43950-image.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/suprsend/iZJ8XgyTL4NrLVtX/images/docs/9ef98fa-image.png?fit=max&auto=format&n=iZJ8XgyTL4NrLVtX&q=85&s=1b1167b4fb3e2e15496ae61082f4a8ea" width="1478" height="830" data-path="images/docs/9ef98fa-image.png" />
    </Frame>

    Add your business phone number. This will be the number from which your business communication will go through. If you are using an existing WhatsApp number, [refer doc](https://developers.facebook.com/docs/whatsapp/cloud-api/get-started/migrate-existing-whatsapp-number-to-a-business-account) to migrate the business number.

    <Frame>
      <img src="https://mintcdn.com/suprsend/3ix_OjxB_ZGM-pa-/images/docs/24485b8-image.png?fit=max&auto=format&n=3ix_OjxB_ZGM-pa-&q=85&s=8f1c479cfa7411e35e19766612f64526" width="1488" height="598" data-path="images/docs/24485b8-image.png" />
    </Frame>

    Follow the steps and do not forget to add a payment method to avoid any errors.

    Once the phone number is added, copy the `Phone number ID` and `WhatsApp Business Account ID` corresponding to this phone number shown in Step 1 of API Setup

    <Frame>
      <img src="https://mintcdn.com/suprsend/JOwfEC79k-vs3tUR/images/docs/98d73cb-image.png?fit=max&auto=format&n=JOwfEC79k-vs3tUR&q=85&s=de96e868f073a98ce64511297554fa2c" width="1674" height="216" data-path="images/docs/98d73cb-image.png" />
    </Frame>
  </Step>

  <Step title="Generate access token" icon={5} stepNumber="5">
    Because the testing access token only last 24 hours, we need to create a token that can last forever:

    <Steps>
      <Step title="Create an admin user">
        * Sign into the [Meta Business Suite](https://business.facebook.com/).

        * Locate your business account in the top-left dropdown menu and click its Settings (gear) icon. Click Business settings.

        * Select **Users -> System users** from the left navigation panel

        <Frame>
          <img src="https://mintcdn.com/suprsend/y77gmHjmaTSnbCzd/images/docs/b2196a8-image.png?fit=max&auto=format&n=y77gmHjmaTSnbCzd&q=85&s=4fd4936890772095a7cc42509acb4321" width="2292" height="1570" data-path="images/docs/b2196a8-image.png" />
        </Frame>

        * Add SuprSend user and give it "`Employee`" access

        <Frame>
          <img src="https://mintcdn.com/suprsend/3ix_OjxB_ZGM-pa-/images/docs/2bc93de-image.png?fit=max&auto=format&n=3ix_OjxB_ZGM-pa-&q=85&s=fb5b5d17befc08839b1fbbe6e312cd06" width="992" height="764" data-path="images/docs/2bc93de-image.png" />
        </Frame>
      </Step>

      <Step title="Assigning assets to the new user">
        * Select the user and Click on "Assign Assets." Assign Full control to the new user. This will allow us to send messages on the behalf of this user through your WhatsApp cloud account.

        <Frame>
          <img src="https://mintcdn.com/suprsend/y77gmHjmaTSnbCzd/images/docs/bb30d99-image.png?fit=max&auto=format&n=y77gmHjmaTSnbCzd&q=85&s=f1c459ca4f1e4d9492e169b357077e08" width="1852" height="1230" data-path="images/docs/bb30d99-image.png" />
        </Frame>

        * Now, we'll have to assign the system user to our WhatsApp account.

        * To do this from WhatsApp settings page go to WhatsApp accounts -> select your account. Now on the right panel there will be an option to**Assign People**, from there assign the System User that we created above to your account. After it's assigned you'll be able to see in **People** section as shown in the image below.

        <Frame>
          <img src="https://mintcdn.com/suprsend/iZJ8XgyTL4NrLVtX/images/docs/a669b83-Screenshot_2024-03-25_at_7.50.50_PM.png?fit=max&auto=format&n=iZJ8XgyTL4NrLVtX&q=85&s=f2a5f1978f03353069367ddc7fd65c4b" width="3010" height="1160" data-path="images/docs/a669b83-Screenshot_2024-03-25_at_7.50.50_PM.png" />
        </Frame>
      </Step>

      <Step title="Generate token">
        Go back to the system users page and select the recently created system user from the list. Then click the Generate new token button. Select your app, token expiry (**never**), and then on the bottom screen select permissions `whatsapp_business_management` and `whatsapp_business_messaging`.

        <Frame>
          <img src="https://mintcdn.com/suprsend/3ix_OjxB_ZGM-pa-/images/docs/1c67abf-image.png?fit=max&auto=format&n=3ix_OjxB_ZGM-pa-&q=85&s=537dde44e8c465493ecb7293975c8c8e" width="1086" height="1156" data-path="images/docs/1c67abf-image.png" />
        </Frame>

        <Frame>
          <img src="https://mintcdn.com/suprsend/y77gmHjmaTSnbCzd/images/docs/b21b8a8-image.png?fit=max&auto=format&n=y77gmHjmaTSnbCzd&q=85&s=fb0aae241d02d36a51a3744e26796981" width="806" height="830" data-path="images/docs/b21b8a8-image.png" />
        </Frame>

        <Check>
          **Copy the Generated Token**

          Click on generate token and copy the token value, please note this value will not be accessible later, so do store it someplace safe.
        </Check>
      </Step>
    </Steps>
  </Step>

  <Step title="Change App Mode to Live" icon={6} stepNumber="6">
    You have now successfully setup your WhatsApp business account. Change the App mode to live to start sending notification to your production users.

    <Frame>
      <img src="https://mintcdn.com/suprsend/ftswjUsq0JlUh-RL/images/docs/0d7b8e8-image.png?fit=max&auto=format&n=ftswjUsq0JlUh-RL&q=85&s=b30a145fd471f63ed8a60ed24c0cf765" width="1726" height="172" data-path="images/docs/0d7b8e8-image.png" />
    </Frame>
  </Step>

  <Step title="Get App ID" icon={7} stepNumber="7">
    We will need App ID associated with your WhatsApp business account. You can either get it from the developers page as shown in screenshot above, to the left of App Mode.

    Alternatively, go to [https://developers.facebook.com/apps](https://developers.facebook.com/apps), here you can see all the apps registered with your meta account. Copy the App ID from the App integrated with SuprSend.

    <Frame>
      <img src="https://mintcdn.com/suprsend/09Y8zJBSaqwwb23r/images/docs/5be4ea2-Screenshot_2023-09-22_at_11.08.27_PM.png?fit=max&auto=format&n=09Y8zJBSaqwwb23r&q=85&s=4a29fd4ca8ceed72a67f7f047da7d911" width="2992" height="1264" data-path="images/docs/5be4ea2-Screenshot_2023-09-22_at_11.08.27_PM.png" />
    </Frame>
  </Step>
</Steps>

## Configure webhook in Meta account for automated template approval and DLR tracking

One of the platform advantage of using SuprSend as a central communication system is that it shows notification analytics for all channels in your SuprSend account together.

To configure webhook URL, copy the URL from the vendor page and add it on your app dashboard (WhatsApp -> Configuration).

Set verify token as `572bcee9-4558-45ee-bbbb-fac5cb08766d`

<Frame>
  <img src="https://mintcdn.com/suprsend/ysJyO3LOXwZ5L098/images/docs/f4ccb03-image.png?fit=max&auto=format&n=ysJyO3LOXwZ5L098&q=85&s=9680949d03e8b10d90cbab0a3aad704d" width="1106" height="460" data-path="images/docs/f4ccb03-image.png" />
</Frame>

on webhook fields-> manage button, subscribe to all events mentioned.

<Frame>
  <img src="https://mintcdn.com/suprsend/y77gmHjmaTSnbCzd/images/docs/bc5b4b2-image.png?fit=max&auto=format&n=y77gmHjmaTSnbCzd&q=85&s=9bcc2133992efc21f889925cb2375abf" width="1486" height="1092" data-path="images/docs/bc5b4b2-image.png" />
</Frame>

## Add vendor configuration on SuprSend

On the SuprSend dashboard, go to vendor page from side panel and click WhatsApp -> WhatsApp Cloud API from the list of Vendors. This will open vendor details page as shown below:

<Frame>
  <img src="https://mintcdn.com/suprsend/ftswjUsq0JlUh-RL/images/docs/1129fbf-image.png?fit=max&auto=format&n=ftswjUsq0JlUh-RL&q=85&s=9ba9fc99c2c7da9a19194deeec504499" width="2326" height="1482" data-path="images/docs/1129fbf-image.png" />
</Frame>

| Form Field                       | Obligation  | Description                                                                                                                                                                                                                                                                                                                                  |
| -------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Nickname**                     | *mandatory* | You can give any name which may help you to identify this account easily                                                                                                                                                                                                                                                                     |
| **Phone number ID**              | *mandatory* | Phone number ID linked to your WhatsApp business number. You can get this from [App dashboard](https://developers.facebook.com/apps) (WhatsApp -> API Setup). [Refer above step](/docs/whatsapp-cloud-api#step-4-add-a-valid-business-phone-number) for more details.                                                                        |
| **Access token**                 | *mandatory* | Access token for authenticating the WhatsApp API request. You can generate a new access token by following the [step above](/docs/whatsapp-cloud-api#step-5-generate-access-token).                                                                                                                                                          |
| **WhatsApp Business Account ID** | *mandatory* | WABA ID linked to your WhatsApp business number. This will be needs to automate the template approval process for your account. You can get this from [App dashboard](https://developers.facebook.com/apps) (WhatsApp -> API Setup). [Refer above step](/docs/whatsapp-cloud-api#step-4-add-a-valid-business-phone-number) for more details. |
| **App ID**                       | *mandatory* | App ID linked to your WhatsApp business account. This is used to auto approve your WhatsApp templates. You can get this from [App dashboard](https://developers.facebook.com/apps). Refer step 7 for more details.                                                                                                                           |
| **Price per notification**       | *optional*  | This is the amount you pay per WhatsApp notification to Meta. It helps us to calculate, estimate and optimise your cost spent on notifications.                                                                                                                                                                                              |

## Migrate existing phone number to Whatsapp Cloud API

If your WhatsApp business number is already registered with another BSP and you want to migrate it to WhatsApp cloud API, [follow this documentation](https://developers.facebook.com/docs/whatsapp/business-management-api/guides/migrate-phone-to-different-waba/) for migration.

***
