Skip to main content
All CollectionsTextPeakStreams API
Creating a Token for WhatsApp Business
Creating a Token for WhatsApp Business
Updated over 5 months ago

As one of the steps of creating a WhatsApp API stream, you need to enter a WhatsApp Business token and your WhatsApp Business ID.

This article will describe how to generate this token and where to get the WhatsApp account ID.
You will also learn how to configure webhooks in your app to be alerted at WhatsApp-related actions.

Generating a WhatsApp Business Token

To create a token:

  1. In your Meta Business Suite account, navigate to the settings menu (the gear icon), expand Users and select System Users. You can also use the following link: https://business.facebook.com/settings/system-users

  2. Click Add.

  3. In the window that pops up, enter the name for the user and select the Admin role.

  4. Click Create System User.

  5. On the system user page, click Generate token.

  6. A new window will pop up where you should specify token attributes:

    1. Select the app for which you are creating the token.

    2. Select the token expiration option.
      ! Please make sure you select Never as you are creating a permanent token.

    3. Assign permissions to the app: whatsapp_business_management and whatsapp_business_messaging.

    4. Click the Generate token button.

  7. You will see your token on the screen. Copy it and click Done.

  8. You can now insert the token in the Auth token field when you create a WhatsApp stream.

Getting the WhatsApp Business ID

  1. Expand the Accounts section in the settings menu and select WhatsApp accounts. Alternatively, use the link: https://business.facebook.com/settings/whatsapp_account

  2. Copy the ID under the needed WhatsApp account.

Use this ID for the Business ID field.

Configuring Webhooks

Set up webhooks for your app to be alerted when you receive a message or when its status changes.

To set up webhooks:

  1. Go to your account at Meta for Developers, navigate to Apps (https://developers.facebook.com/apps/), and select the needed app.

  2. In the main menu on the left, expand the WhatsApp section and select Configuration.

  3. In the Webhook section, specify the webhook callback URL:

    1. Click Edit.

    2. In the pop-up window that appears, enter the needed details.
      Callback URL: https://textpeak-streams.commpeak.com/webhooks/whatsapp
      Verify token: SismaKala

    3. Click Verify and save.

  4. Select the webhook fields:

    1. Click Manage.

    2. In the window that pops up, select the following webhook fields:
      messages
      phone_number_name_update
      template_category_update

    3. Click Done.

IMPORTANT

We recommend that you select v18.0 in the Subscription version column.

Did this answer your question?