Platforms / WhatsApp

WhatsApp API

Send and receive WhatsApp Business messages and templates.

At a glance

Platform id
whatsapp
Connects
business number
Sign-in
OAuth: the user approves on the platform's own page
Post types
Text · Image · Video · Template message

Capabilities

What WhatsApp supports here
PublishingPartly
SchedulingYes
CommentsNo
Direct messagesYes
MentionsNo
ReviewsNo
AnalyticsNo

Required on every post

  • platform_data.whatsapp.to: one or more phone numbers.

Options

Send these in platform_data.whatsapp on the post, or flat in a target's own platform_data (the target's keys win). See Publishing.

platform_data options for WhatsApp
KeyTypeWhat it does
torequiredstring or string[]Recipients in international format. A comma list is accepted.
template{ name, language, components? }Send an approved template instead of free text (needed outside the 24-hour window). language is a code such as en_US.
preview_urlbooleanShow a preview of the first link in a text message.

Limits

  • Text 4,096 characters; media captions 1,024.
  • One image or one video per message.

Text over the limit fails validation before anything is sent. The caps of this server are explained in Rate limits.

Good to know

  • The connect call takes a top-level onboarding: cloud_api (default) for a number used only through the API, or business_app for a number that stays on the WhatsApp Business app.
  • Outside the 24-hour customer-service window only approved templates can be sent; the window reopens with each message the customer sends.
  • No message history: the inbox fills from webhooks received after you connect.
  • A tap on a reply button, list row or template quick reply arrives as dm.received with the tap's payload and interactive_type in its metadata. Every dm.received carries phone_number_id.
  • dm.status.sent, delivered, read and failed follow each message you send; a failure carries WhatsApp's error_code, error_title and error_message.
  • "Publishing" sends one message (text, one image or video, or a template) to each number you list; WhatsApp has no posts.
  • Meta bills template messages per message category and country; replies inside the 24-hour window are free.

Publish with the API

curl https://api.zaynstack.com/v1/posts \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from SocialWire",
    "media": [{ "type": "image", "source_type": "url", "source": "https://example.com/file.jpg" }],
    "platform_data": { "whatsapp": { "to": ["+14155550100"] } },
    "targets": [{ "account_id": "<WhatsApp account id>" }],
    "publish_now": true
  }'

An operation WhatsApp cannot do answers 501 resource.not_supported. Agents can do the same through the MCP server.

Connection errors

A connection that fails comes back to your redirect_uri with status=error, error=<code> and error_description, or as the error of the connect call. All codes: Connect accounts.

Connection error codes for WhatsApp
CodeMeaning
whatsapp.no_wabaThe sign-in shared no WhatsApp Business Account.
whatsapp.no_phone_numberThe WhatsApp Business Account has no phone number.
account.already_linkedThe brand already holds a different account on this platform, or the account belongs to another brand while lock_accounts_to_brand is on.
billing.brands_limitNo brand_id was sent, so a new brand was needed, and the plan has no room for another brand.

Webhook events

Every platform sends the post.* and account.* events. WhatsApp also sends:

  • dm.received (button and list taps included)
  • dm.sent
  • dm.status.sent / delivered / read / failed

Webhook events and their payloads

Not supported yet

  • Importing the chat history of a number that also uses the WhatsApp Business app (coexistence).
  • Posts, comments and analytics.

Developer setup (self-hosting)

Only the operator of this server does this, once. Users then just click Connect.

  1. Create an app at developers.facebook.com → My Apps → Create app → type Business.
  2. Add the WhatsApp product to the app.
  3. Paste the Callback address shown below into Valid OAuth Redirect URIs.
  4. Under Webhooks, subscribe with the Webhook address below and your META_WEBHOOK_VERIFY_TOKEN.
  5. App settings → Basic: add Privacy Policy URL, Terms URL, User data deletion URL, app icon and category.
  6. Facebook Login for Business → Configurations: create one for WhatsApp Embedded Signup and put its id in WHATSAPP_CONFIG_ID.
Callback address
https://api.zaynstack.com/api/connect/whatsapp/callback
Webhook address
https://api.zaynstack.com/api/hooks/whatsapp
Server variables
FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, WHATSAPP_CONFIG_ID, META_WEBHOOK_VERIFY_TOKEN
Developer console
WhatsApp developer console

Permissions requested

  • whatsapp_business_management
  • whatsapp_business_messaging

When a reconnect grants fewer permissions than before, an account.updated event with change permissions_reduced is sent. Accounts connected before a permission was added keep working but must reconnect to use the features it unlocks.

Before anyone can connect (review)

  1. Business verification of your company in Meta Business Manager (documents + domain).
  2. App Review: request Advanced Access for every permission listed below, each with a screencast of the feature and test instructions.
  3. Switch the app to Live mode after approval.
  4. Become a Tech Provider (Meta) so customers can onboard their own numbers through Embedded Signup.

Typical wait: 2-4 weeks. Until then the app works for your own accounts and the testers you add in the console.

Other platforms

Free to start

Your next post can go everywhere at once.

No card. Connect a profile, send a post, see it land.