Messaging
Send & receive, two ways.
Templates
Reach people outside the 24h window.
Connect
WhatsApp uses Meta’s Embedded Signup: your user brings their own number, inside a Facebook-hosted flow that also creates or picks their WhatsApp Business Account.authUrl. The user signs in with Facebook, selects or creates
a WABA, and verifies the phone number. PlugKit stores the number, exchanges a
long-lived token and subscribes it to webhooks.
If inbound messages ever stop arriving, re-subscribe the number without
reconnecting it:
Send a message
A thread is a conversation. Open (or find) one for a phone number in international format, then send into it:The 24-hour window
Meta accepts free-form text only within 24 hours of the contact’s last message. Past that, only an approved template goes through — free-form text doesn’t “mostly work”, it is rejected. List what the WABA has had approved:{{1}}, {{2}} placeholders in order:
components is
the escape hatch for headers and buttons — raw Meta components, passed through.
Read the inbox
Inbound messages arrive by webhook. List and read them like any platform:When it stops working
An account carriesisActive and needsReconnection, plus a
disconnectedReason when we know it — check them before assuming a send failed
for its own reasons:
- Meta can refuse to serve the phone number while the token is perfectly valid — after a coexistence disconnect on the phone side, for instance. Sends then fail with a Meta error rather than an auth error.
- Reconnecting the same number updates the existing account in place, so
conversations and history are kept. If a reconnection ever lands on a second
account for the same real number — a different WABA, say — fold it back with
POST /v1/accounts/{id}/replace, which moves everything onto the account you keep and deletes the other.
Permissions
whatsapp_business_messaging (send and receive) and
whatsapp_business_management (business account and numbers).