Official WhatsApp Documentation - WA Sender Resources

Official WhatsApp Business API Integration

Complete guide to integrating and using the Official WhatsApp Business API with WA Sender

Quick Setup Steps

๐Ÿ“ Prerequisites

  • โ€ข Facebook Business Manager account
  • โ€ข WhatsApp Business API access
  • โ€ข Verified business phone number
  • โ€ข Meta Developer account

๐Ÿ”‘ Required Credentials

  • โ€ข Access Token
  • โ€ข Phone Number ID
  • โ€ข Business Account ID
  • โ€ข App Secret

Step-by-Step Setup Guide

1 Get WhatsApp Business API Access

First, you need access to the WhatsApp Business API through Facebook:

  1. Go to Facebook Business Manager
  2. Create a Business Manager account if you don't have one
  3. Apply for WhatsApp Business API access
  4. Complete the business verification process
  5. Get your WhatsApp Business Account approved

2 Configure Facebook Developer App

Set up your app in Facebook Developer Console:

  1. Go to Facebook Developer Console
  2. Create a new app or use existing one
  3. Add "WhatsApp Business" product to your app
  4. Configure your WhatsApp Business Account
  5. Get your Access Token and Phone Number ID

3 Configure Environment Variables

Add these credentials to your .env file:

# Official WhatsApp Business API Configuration
WHATSAPP_OFFICIAL_ACCESS_TOKEN=EAAxxxxxxxxxxxxxxx
WHATSAPP_OFFICIAL_PHONE_NUMBER_ID=1234567890123456
WHATSAPP_APP_SECRET=your_app_secret_here
WHATSAPP_WEBHOOK_VERIFY_TOKEN=your_custom_token

4 Set Up Webhook

Configure webhook to receive incoming messages:

  1. In Facebook Developer Console โ†’ WhatsApp โ†’ Configuration
  2. Set Webhook URL to: https://yourdomain.com/api/webhook/whatsapp/official
  3. Set Verify Token to your custom token from .env
  4. Subscribe to: messages, message_status

5 Create Official Device in WA Sender

Now create your official WhatsApp device:

  1. Go to Create New Device
  2. Select "Official WhatsApp Business API"
  3. Fill in device name and details
  4. Enter Phone Number ID and Business Account ID
  5. Click "Create Device"

Official vs Unofficial API Comparison

Feature Official API Unofficial API
Cost ๐Ÿ’ฐ Paid (per message) ๐Ÿ†“ Free
Setup Complexity ๐Ÿ”ด Complex (Facebook approval) ๐ŸŸข Simple (QR scan)
Reliability ๐ŸŸข High (99.9% uptime) ๐ŸŸก Medium
Template Messages โœ… Supported โŒ Not supported
Interactive Messages โœ… Buttons, Lists โŒ Text only
Media Upload โœ… Direct upload โœ… URL-based

Common Issues & Solutions

โŒ "Official WhatsApp API not configured" Error

Solutions:

  • Verify all environment variables are set in .env file
  • Restart Phoenix server after updating .env
  • Check access token validity (tokens expire every 24-60 days)
  • Ensure phone number ID is correct

โš ๏ธ Webhook Verification Failed

Solutions:

  • Ensure webhook URL is publicly accessible (no localhost)
  • Verify webhook verify token matches exactly
  • Check app secret is correct in Facebook settings
  • Ensure HTTPS is enabled on your domain

Need Help?

๐Ÿ“š Documentation

๐Ÿ› ๏ธ Test Tools

  • โ€ข Run verification script: elixir verify_official_setup.exs
  • โ€ข Test API connection: elixir test_official_whatsapp.exs
  • โ€ข Check device status in dashboard