Let Your Clients Connect Their Own WhatsApp with Hosted Embedded Signup
This guide shows you how to let each of your clients connect its own WhatsApp Business Account (WABA) to its Sender Profile from your product. You create an Embedded Signup link from your backend and send the client to it. On that page, hosted by Sent, the client goes through Meta's Embedded Signup: it signs in to Meta, picks or creates its WhatsApp Business Account and number, and the account is connected to the profile. The client needs no Sent account and never sees your API key.
When to Use Hosted Embedded Signup
| Approach | Who signs in to Meta | What you need |
|---|---|---|
| Hosted Embedded Signup | Your client, on Sent's page | A Sender Profile per client. No Meta app of your own. |
| Multi-Partner Solution | Your client, in your own Embedded Signup | Your own Meta app as a Tech Provider |
| Dashboard | You, or anyone you invite to your Sent account | Access to the client's Meta Business Account |
Use Hosted Embedded Signup when your clients own their WhatsApp accounts and you want them to connect without leaving your product's flow or joining your Sent account.
Before You Start
- A Sender Profile for the client. Create one with
POST /v3/sender-profilesor in the dashboard. To connect your organization's own account instead, see Connect Your Organization's Own WhatsApp. - An organization API key, used with
x-profile-id, or the profile's own API key. Call the API from your backend only. - A page to come back to.
return_urlis where Sent sends the client when it is done. It must be an absolutehttpsURL (httpis accepted onlocalhostonly) without a#fragment. - The client's Meta requirements. The client needs what anyone connecting a WABA needs: a Facebook account with administrator access to a verified Meta Business Account, and a number not linked to another WABA. See Before you start.
Meta's window names Sent as the app asking for access, because Sent connects and sends from the account. Tell your clients to expect it.
Connect a Client's WhatsApp
Create an Embedded Signup Link
Call POST /v3/channels/whatsapp/embedded-signup from your backend, scoped to the client's profile:
curl -X POST "https://api.sent.dm/v3/channels/whatsapp/embedded-signup" \
-H "x-api-key: $ORG_API_KEY" \
-H "x-profile-id: $PROFILE_ID" \
-H "Content-Type: application/json" \
-d '{
"return_url": "https://app.example.com/settings/whatsapp",
"state": "client-1842",
"ttl": 3600
}'| Field | Required | What it does |
|---|---|---|
return_url | No | Where the client goes when it is done, up to 1024 characters. Without it, the page tells the client to close the window. |
state | No | Your own value, such as your ID for the client, up to 256 characters. Sent hands it back unchanged. |
ttl | No | How long the link can be opened, in seconds: 300 to 86400. Defaults to 3600. |
The response carries the link:
{
"success": true,
"data": {
"organization_id": "550e8400-e29b-41d4-a716-446655440000",
"profile_id": "770e8400-e29b-41d4-a716-446655440002",
"url": "https://app.sent.dm/connect/whatsapp?token=Xr7kQ2pL...",
"expires_at": "2026-12-01T13:00:00Z"
}
}Send the Client to the Link
Either redirect the browser to url, or open it in a popup from a click so the browser doesn't block it. The page can't be shown in an iframe.
// Redirect
window.location.assign(link.url);
// Or a popup, opened from the click handler
window.open(link.url, "sent-whatsapp", "width=600,height=800");On the page the client selects Connect WhatsApp, signs in to Meta, and chooses the account and number to connect.
Handle the Return
When the client is done, Sent sends the browser to your return_url with two query parameters added:
https://app.example.com/settings/whatsapp?status=connected&state=client-1842status is connected, or cancelled when the client went back without connecting.
If you opened the link in a popup, the page first posts the outcome to the window that opened it, then goes to your return_url too. Close the popup from your return page with window.close(). The message is posted only to the origin of your return_url: a window on another origin doesn't receive it, so rely on the return URL there. Check the origin before you trust the message:
window.addEventListener("message", (event) => {
if (event.origin !== "https://app.example.com") return;
if (event.data?.type !== "sent.whatsapp_connect") return;
const { status, state, profile_id } = event.data;
// status: "connected" | "cancelled"
});Confirm the Connection
The return and the message travel through the client's browser, which can lose or alter them. Treat them as a hint and confirm from your backend with GET /v3/sender-profiles/{id}:
curl "https://api.sent.dm/v3/sender-profiles/$PROFILE_ID" \
-H "x-api-key: $ORG_API_KEY"The account is connected once channels.whatsapp is present:
"whatsapp": {
"waba_id": "1856257688623149",
"phone_number_id": "1378203442050516",
"owner_business_id": "4124366294503284",
"status": "ACTIVE"
}Connect Your Organization's Own WhatsApp
Call the same endpoint with your organization's API key and no x-profile-id, and the link connects your organization's own WhatsApp Business Account. Use it to let whoever holds your Meta Business Account, an agency or your IT team for example, connect it without a Sent account.
curl -X POST "https://api.sent.dm/v3/channels/whatsapp/embedded-signup" \
-H "x-api-key: $ORG_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "return_url": "https://app.example.com/settings/whatsapp" }'The response's profile_id is null, and so is the profile_id in the popup message. Confirm the connection with GET /v3/channels, which shows the account under whatsapp.
An organization that owns a Multi-Partner Solution can't replace its own account this way, because the partnership depends on it. The same goes for a Sender Profile whose account came through the partnership.
How Embedded Signup Links Behave
- A link works until it expires, not just once. Each use connects the account the client picks, replacing the one before, so opening it again is harmless. Keep
ttlas short as your flow allows, and create a new link each time you send a client to the page. - Retries create new links. The response is never stored for
Idempotency-Key, because the link is a secret. A retry with the same key creates another link; the one you didn't use expires. - A link expires after
ttlseconds. An expired link shows the client that it has expired and to ask you for a new one. - A link works in the browser that opened it. Once the page has opened, a copy of its address doesn't work in another browser. Send the client the
urlitself. - A failed connection can be retried with the same link while it lasts. If the client closes Meta's window, the page offers to try again or to go back to you.
- Connecting replaces the existing account. A profile, or your organization, that already has a WhatsApp account gets the new one.
- A profile that is suspended, deactivated, released, or deleted can't be connected, and neither can one whose organization is. The link shows the client that it can no longer be used.
Until it expires, the url lets anyone who has it connect a WhatsApp account to that profile or organization. Send it only to the client it is for, over your own authenticated session, and don't log it.
From an AI Agent
Over the Sent MCP server, channels.whatsapp.embedded_signup_link gives an agent the same link to hand to the user, valid for 24 hours. Without profileId it connects your organization's own WhatsApp Business Account; with profileId, that Sender Profile's. The same accounts are refused as over the API.
Errors
| Response | Cause |
|---|---|
400 VALIDATION_001 on return_url, state, or ttl | The value is outside the rules in the table above, or return_url and state together are too long to fit in a link (mostly non-ASCII values near their limits). |
400 VALIDATION_001 with no field | The account came through, or anchors, a Multi-Partner Solution, so a link can't replace it. |
403 BUSINESS_014 | The Sender Profile or organization is suspended. |
503 INTERNAL_005 | Links can't be created right now. Retry later. |
Test Mode
With "sandbox": true in the body, the call is validated and answers with a link in the same shape, but nothing is stored and the link can't be used. See Test mode.
Related
- Connect a WhatsApp Business Account: the dashboard flow, and connecting accounts you already hold
- Onboard client WhatsApp accounts with a Multi-Partner Solution: when you own a Meta app as a Tech Provider
- Multi-tenant architectures: choosing a tenant model
- Create and activate Sender Profiles via the API: creating the profile a link is for
Onboard client WhatsApp accounts with a Meta Multi-Partner Solution
Partner with Sent on Meta through a Multi-Partner Solution, onboard your clients' WhatsApp Business Accounts into it, and attach each one to a Sender Profile.
Managing channels
Read and change a sender's channels through the API: SMS markets per country and sender type, the WhatsApp account, the RCS agent, the numbers that take phone calls, and what each one still owes for compliance.