📌 Step 1: Go to Meta Business Manager
- Open: https://business.facebook.com
- Select your Business Account
- Go to Settings (Business Settings)
📌 Step 2: Create System User
- Navigate to:
Users → System Users - Click Add
- Enter:
- Name (Example: WhatsAppBot)
- Role: Admin
👉 Click Create System User
📌 Step 3: Assign Assets (Very Important)
- Select the created System User
- Click Assign Assets
- Choose:
- WhatsApp Business Account
- Give permissions:
- Full Control
📌 Step 4: Generate Permanent Token
- Click Generate New Token
- Select your app
- Add permissions:
- whatsapp_business_management
- whatsapp_business_messaging
👉 Click Generate Token
⚠️ Copy and save this token immediately!
📌 Step 5: Use Token in API
Use this token in your API headers:
Authorization: Bearer YOUR_PERMANENT_TOKEN
📌 Step 6: Test API
Send a message using:
POST https://graph.facebook.com/v18.0/PHONE_NUMBER_ID/messages
If successful → 🎉 Your permanent token is working!
⚠️ Common Errors & Fixes
❌ Error: Permission denied
👉 Fix:
- Missing whatsapp_business_messaging permission
- Re-generate token with correct scopes
❌ Error: Token invalid
👉 Fix:
- Token copied incorrectly
- Regenerate again
❌ Error: App not linked
👉 Fix:
- Ensure app is added to Business Manager
- Assign assets properly
❌ Error: (#200) Permissions error
👉 Fix:
- System user not assigned correctly
- Enable full control
💡 Pro Tips
- Store token securely (never expose in frontend)
- Use environment variables
- Rotate tokens if needed
- Use logging for API failures
🎯 Why System User Method is Best?
- No expiry (long-term use)
- Stable for production apps
- Recommended by Meta
- Supports automation and scaling
🏁 Conclusion
Generating a permanent access token using the System User method is essential for running a stable WhatsApp API system.
Once configured, your application can send messages 24/7 without interruption.