This guide explains how you can create a new Facebook app and link a phone number for sending WhatsApp messages with the WhatsApp Cloud API.
Please note that you can only send messages from a phone number that is not linked to any WhatsApp account. If a phone number is already registered with your WhatsApp app, you need to deregister it first.
Create a Facebook App
- Go to developers.facebook.com/apps and click on Create App. Select Business as the app type. The Business app type is for Facebook apps that help businesses send WhatsApp messages and manage their WhatsApp Business accounts.
- Give your App a name, provide your contact email address and click on Create App. If you have a Business Manager account, you can select it from the dropdown menu.
- You are redirected to the product's dashboard. Choose WhatsApp, which allows you to send WhatsApp messages from your app with the WhatsApp Cloud API. Click Set Up to continue.
- Select your business account from the dropdown menu and click Continue. If you don't have a Meta Business account, a new account will be created for you.
- Click on Start using the API on the next screen. This page also contains helpful links to video tutorials and documentation on using the WhatsApp Business platform.
- Facebook will now generate a temporary access token that allows you to test your WhatsApp Cloud API integration. However, we will not use this token since it expires after 24 hours. So instead, we will generate a permanent access token.
Add a Phone Number
Scroll down the page and click on Add a Phone Number button. You need to associate a phone number with the WhatsApp API to send messages to any WhatsApp number.
Also, provide a display name for your phone number and that will show as the sender for your business phone number once approved.
Once the phone number has been added, go to Step 1 and choose the phone number you just added. Next, copy the WhatsApp Business Account ID for this phone number.
Now that you have made a note of the WhatsApp Business Account ID, you can go to the next step and generate a permanent access token.