Prerequisites
Before setting up the WhatsApp API, ensure you have the following:
- A Gmail account for your business.
- A Facebook account for your business.
- Access to Meta Business Suite.
- Access to Meta for Developers.
Setup Process
Step 1: Create Business Accounts
- Create a Gmail account for your business.
- Create a Facebook account for your business.
- Log in to Meta Business Suite using your business Facebook account.
- Create a Business Portfolio in Meta Business Suite.
Step 2: Register on Meta for Developers
- Go to Meta for Developers. (https://developers.facebook.com/)
- Register your business by verifying the business phone number (Note: The number cannot already have a WhatsApp account.)
- After registration, click Create App.
- Enter the necessary details and click Next.
- Select the use case as Other, then click Next.
- Choose Business and click Next.
- Choose Developer and click Next.
- Review the overview and finish the process.
- Complete the process.
Step 3: Add WhatsApp Product to App
- Inside the created app, click Add Product in the sidebar.
- Under “Add Product,” click Set Up for WhatsApp and complete the steps.
- Click Start Using the API.
- Enter your Business Name, Business Website URL (or Page URL), and Country.
- Complete the process.
Step 4: Configure WhatsApp in Meta Business Suite
- Go to: Settings → Accounts → WhatsApp Accounts → Add.
- If you already have a WhatsApp Business Account, link it.
- Otherwise, create a new one.
2. Go to: Users → System Users → Add.
- Enter the system user name.
- Set the role as Admin.
3. Assign Assets:
- Click Assigned Assets → select your app → enable Full Control.
- Again, click Assigned Assets → select your WhatsApp account → enable Full Control.
Step 5: Generate Access Token
- Click Generate New Token.
- Select your app.
- Check scopes:
whatsapp_business_managementwhatsapp_business_messaging
4. Set for No Expiry.
5. Save the generated token securely (you will need it later).
Step 6: Retrieve WhatsApp Phone Number ID
In Meta for Developers → WhatsApp → API Setup, find your WhatsApp Phone Number ID.
Register Your WhatsApp Number
Use the following cURL command to register your number:
curl -i -X POST "https://graph.facebook.com/v17.0/{PHONE_NUMBER_ID}/register" \
-H "Authorization: Bearer YOUR_LONG_LIVED_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"pin": "123456", Your Facebook account’s 2FA PIN
"certificate": "cert"
}'
Replace:
{PHONE_NUMBER_ID}with your actual phone number ID.YOUR_LONG_LIVED_TOKENwith the token generated earlier.pinwith your 2FA PIN from Facebook.
Sending WhatsApp Messages
Once your number is registered, you can send messages using the API.
Example cURL request:
curl --location --request POST 'https://graph.facebook.com/v17.0/{PHONE_NUMBER_ID}/messages' \
--header 'Authorization: Bearer YOUR_LONG_LIVED_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"messaging_product": "whatsapp",
"to": "94773581240",
"type": "template",
"template": {
"name": "your_custom_template_name",
"language": { "code": "en_US" },
"components": [
{
"type": "header",
"parameters": [
{ "type": "text", "text": "Test Header" }
]
},
{
"type": "body",
"parameters": [
{ "type": "text", "text": "all permissions has been denied" }
]
}
]
}
}'
Important Notes (Free Tier Limitations)
In the free tier, the merchant (client) must first send a message to the courier company to start the conversation.
After that, the courier service staff can send notifications actively.
A conversation session is active for only 24 hours between the two parties in the free tier.
WhatsApp API Implementation Summary
Configuration steps completed via Meta Business Suite and Meta for Developers.
Token and Phone Number ID are required for API calls.
âś… This completes your step-by-step user guide for setting up and integrating the WhatsApp Message API with the Curfox Staff Portal.