Skip to main content
Use this path after setting up MPS with Messages processed by: Kapso. Kapso runs messaging and completes onboarding for you.

At a glance

  1. Choose the onboarding experience: send a hosted setup link or embed onboarding in your app with @kapso/sdk.
  2. Create a setup link for each customer, choosing the connection type and who pays Meta fees.
  3. Let the customer connect: share the link’s URL, or pass its token to the SDK.
  4. Confirm the connection and billing through a completion webhook and a funding check if you selected Kapso credits.
Both options use a setup link. Hosting onboarding on your domain does not change who processes messages: Kapso still does. The customer completes onboarding on a page hosted by Kapso. No frontend SDK is needed.
  1. Create a customer setup link. Choose customer_managed for direct Meta billing or partner_managed to use Kapso credits.
  2. Send the returned url to the customer or open it from your product.
  3. Confirm the connection and billing after the customer finishes.

Embed in your app

Use @kapso/sdk to open onboarding directly from your product. Your backend creates the same setup link, but passes its token to the browser instead of sharing its URL. Never expose your Kapso API key.
@kapso/sdk requires an active Kapso Multi-partner Solution. It is not a generic embedded signup SDK and does not work with standalone custom Meta apps.

Requirements

The setup link must allow exactly one connection type: dedicated or coexistence. Create separate setup links if your product offers both paths.

Install the SDK

Keep your Kapso API key on the server. Create one setup link for the customer and specify every browser origin that may launch it.
Return only data.token to your frontend. Do not expose your Kapso API key.

Connect from the browser

The resolved connection includes:
The SDK validates the token and browser origin, loads the Meta JavaScript SDK, runs embedded signup with your Multi-partner Solution, and resolves once Kapso confirms the connection.

Configure the setup path

The setup link controls the customer experience:
  • allowed_connection_types: ["dedicated"] — API-only WhatsApp number
  • allowed_connection_types: ["coexistence"] — keep using WhatsApp Business App
  • provision_phone_number: true — use a Kapso-provided or project-pool number
  • meta_billing_mode: "partner_managed" — use Kapso credits for Meta fees
Set these on the server when you create the link. The browser receives only the setup token.

Handle cancellation and errors

Catch SDK initialization failures separately from connection failures. Keep connect() inside the button’s click handler so the browser allows Meta’s popup.
Call whatsapp.destroy() if your application removes the onboarding component before setup completes.

Confirm connection and billing

For either onboarding option, use the setup redirect or SDK result for immediate UI feedback. For server-side reliability, subscribe to Kapso project webhooks and listen for whatsapp.phone_number.created. If you selected partner_managed, also confirm that managed funding is verified before sending paid messages. A successful WhatsApp connection alone does not confirm funding. Resolve any billing attention state first. See Detect connection and Webhooks.

You run messaging

If your MPS uses Messages processed by: Your infrastructure, follow Your infrastructure. That path uses Meta’s SDK, not @kapso/sdk.