Documentation / Complete
Integrator journey: onboarding and webhooks 100 % by API
GET /v1/onboarding-links/{id}
Building with AI? Connect it to your account over MCP: it checks your setup, creates webhooks and templates with your confirmation and writes the code for you. See how →
If you onboard your customers from your own system, without opening the dashboard, this is the whole path, in five steps.
1. One link per customer. POST /v1/onboarding-links with your externalId (your id for that customer) and webhook: { url }. We return the url for your customer and the webhook's whsec_… secret once: store it now, it signs everything about that customer. An externalId already used by another number of your account returns 409 right here, not at the end of onboarding.
2. Your customer connects. They open the url, log in with their Meta account and pick their number. When they finish, the number is born with its webhook (the link's URL) and onboarding.completed arrives there, with connection.id (conn_…), your externalId, reconnected and the webhookId. A new number also brings connection.created, as always.
3. If they don't finish, you still find out. Every attempt that stops (failed, cancelled or abandoned) sends onboarding.failed to the link webhook's URL, signed with the same secret: reason (meta_error, coex_gate (Meta did not enable Coexistence for the portfolio your customer chose), incomplete, timeout, cancelled, abandoned…), metaErrorCode, metaMessage and metaSessionId (the session_id Meta's support asks for) if Meta gave them, and linkUsable (whether your customer can retry with the same link). attemptId identifies the attempt. «Cancel and start over» does not send it: it is not an outcome, the next attempt brings the real one. If you'd rather ask: GET /v1/onboarding-links?externalId=… or GET /v1/onboarding-links/{id} return outcome (pending, completed or failed, with the same reason).
4. The number's webhook is yours. See and change it with /v1/webhooks?externalId=…: URL, events, static header, rotate the secret, test it.
5. Offboarding. When the number disconnects (from the dashboard, because the business removed our access in Meta, or because the permission was revoked), its webhook is switched off (active: false, disabledReason: "connection_disconnected") and stops receiving. If the same number reconnects, it comes back on by itself; the ones you paused or we switched off for failing don't. To disconnect it from your system: DELETE /v1/connections/{id} (conn_… or your externalId). It is the same as «Disconnect» in the dashboard: it stops routing through WAIA Connect, deletes nothing in Meta (the number stays in your customer's WhatsApp account) and frees the slot in your plan at once (slots in the response; the plan's price does not change). Your account webhooks receive connection.disconnected, and so does the number's own webhook if it asks for it (it gets it even though the disconnection switches it off). Calling it again returns 200 with the same body; a number of another account, 404.
# 1) one link per end-customer: your id + the webhook its number will have
curl -X POST https://api.waiaconnect.com/v1/onboarding-links \
-H "Authorization: Bearer wc_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"externalId": "pharmacy-42", "label": "Pharmacy 42", "mode": "coexistence",
"webhook": {"url": "https://api.yourcompany.com/hooks/connect"}}'
# → 201 { "publicId": "onb_…", "url": "https://…/c#<token>", "expiresAt": "…",
# "webhook": { "secret": "whsec_…", "createdOnCompletion": true, … } } ← store the secret NOW
# 2) send "url" to your customer. Then, on https://api.yourcompany.com/hooks/connect:
# { "type": "onboarding.completed", "connection": { "id": "conn_…", "externalId": "pharmacy-42", … },
# "data": { "onboardingLinkId": "onb_…", "reconnected": false, "webhookId": "wh_…", … } }
# { "type": "onboarding.failed", "connection": { "id": null, … },
# "data": { "externalId": "pharmacy-42", "reason": "meta_error", "metaErrorCode": 2655093,
# "metaMessage": "The business is already sharing…", "metaSessionId": "01a1…",
# "linkUsable": true, … } }
# 3) or ask (polling) by your id
curl "https://api.waiaconnect.com/v1/onboarding-links?externalId=pharmacy-42" -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "links": [ { "id": "onb_…", "status": "used", "connectionId": "conn_…",
# "outcome": { "state": "completed", "connectionId": "conn_…", "webhookId": "wh_…", … } } ] }
curl https://api.waiaconnect.com/v1/onboarding-links/onb_… -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# 4) the number's webhook, by your id (PATCH to change url/events, rotate-secret, test)
curl "https://api.waiaconnect.com/v1/webhooks?externalId=pharmacy-42" -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# 5) offboarding, by your id (or conn_…): the same as «Disconnect» in the dashboard
curl -X DELETE https://api.waiaconnect.com/v1/connections/pharmacy-42 -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → 200 { "id": "conn_…", "externalId": "pharmacy-42", "status": "disconnected",
# "disconnectedAt": "…", "slots": { "used": 2, "limit": 5 }, "connection": { … } }
# its webhook switches off (disabledReason: "connection_disconnected"); your account webhooks get
# connection.disconnected. Again → 200, same body. Reconnecting the number switches it back on.Before a new number's first campaign: GET /v1/connections/{id}/sending-status says whether it can start conversations and what your customer is missing at Meta (see Sending status).
Without webhook in the link, onboarding.completed and onboarding.failed go to your account webhooks (in onboarding.failed, connection.id is null: your externalId is in data).
A webhook with an explicit events list that doesn't include these types won't receive them; one with all events starts receiving them.
In onboarding links, connectionId now comes as conn_…; the internal id stays in legacyConnectionId, which will be removed.
outcome.state = failed also when the link expired (link_expired) or you revoked it (link_revoked) before your customer finished.
Does your customer sell with the WhatsApp catalog? Carts arrive through the same webhook: see Catalog shopping carts.