> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kapso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Onboard customers with your own Meta app

> Use Kapso setup links with your own Meta app and embedded signup configuration

Use this when you want customers to connect their own WhatsApp Business accounts through Kapso setup links, but under your Meta app.

For this to work you need to be a [Tech Provider](/docs/platform/become-tech-provider).

## How it works

1. You create a Meta app.
2. You configure Facebook Login for Business for WhatsApp embedded signup.
3. You save the embedded signup config ID in Kapso.
4. You create one Kapso customer per business.
5. You generate setup links for those customers.
6. Customers log in with Facebook and connect their WhatsApp assets.
7. Kapso registers the number and gives you the `phone_number_id`.

## Requirements

You need:

* a [Meta app](/docs/platform/create-meta-app)
* Facebook Login for Business on that app
* an embedded signup configuration ID
* [Be a Meta Tech Provider](/docs/platform/become-tech-provider).

## Configure Facebook Login for Business

In your Meta app:

1. Add **Facebook Login for Business** if it is not already present.
2. Open **Facebook Login for Business > Configurations**.
3. Create a configuration from the WhatsApp embedded signup template when available.
4. If you create a custom configuration, choose the **WhatsApp Embedded Signup** login variation.
5. Select only the assets and permissions your customers need.
6. Save the configuration.
7. Copy the generated **Configuration ID**.

This Configuration ID is the **Embedded signup config ID** Kapso asks for.

## Add domains for embedded signup

In **Facebook Login for Business > Settings**, configure the OAuth and JavaScript SDK settings required by Meta.

Add the domains where customers launch setup links or embedded signup. For Kapso-hosted setup links, include the Kapso setup domain shown in the generated link, usually `app.kapso.ai`. If you launch setup from your own app, include your app domain too.

Meta requires HTTPS domains for embedded signup.

## Add the config ID in Kapso

1. In Kapso, open **Connected numbers > Meta apps**.
2. Edit or add your Meta app.
3. Turn on **Default app for embedded signup**.
4. Paste the **Embedded signup config ID**.
5. Save.

Kapso setup links and reconnect flows can now use this app for embedded signup.

## Create customers

Create one Kapso customer per business you serve.

```bash theme={null}
curl -X POST https://api.kapso.ai/platform/v1/customers \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {
      "name": "Acme Clinic",
      "external_customer_id": "acme-clinic"
    }
  }'
```

Use `external_customer_id` to map Kapso customers back to your own database.

## Generate setup links

Create a setup link for each customer.

```bash theme={null}
curl -X POST https://api.kapso.ai/platform/v1/customers/{customer_id}/setup_links \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "setup_link": {
      "success_redirect_url": "https://your-app.com/whatsapp/success",
      "failure_redirect_url": "https://your-app.com/whatsapp/failed",
      "allowed_connection_types": ["dedicated"]
    }
  }'
```

Send the returned `url` to the customer or open it from your onboarding UI.

Use `allowed_connection_types` to control the customer path:

* `["dedicated"]` for API-only WhatsApp Cloud API numbers
* `["coexistence"]` for customers who want to keep using the WhatsApp Business App alongside Kapso
* `["coexistence", "dedicated"]` when you want the customer to choose

If you want Kapso to provision a number during setup, add:

```json theme={null}
{
  "setup_link": {
    "provision_phone_number": true,
    "phone_number_country_isos": ["US"]
  }
}
```

## Detect completion

Use both redirect handling and webhooks.

The success redirect can include setup details such as:

* `status`
* `phone_number_id`
* `business_account_id`
* `display_phone_number`
* `setup_link_id`

For server-side reliability, subscribe to Kapso project webhooks and listen for `whatsapp.phone_number.created`.

See [Detecting WhatsApp connection](/docs/platform/detecting-whatsapp-connection) and [Webhooks](/docs/platform/webhooks/overview).

## Operate the customer number

After setup completes, use the customer's `phone_number_id`.

```bash theme={null}
curl -X POST https://api.kapso.ai/meta/whatsapp/v24.0/{phone_number_id}/messages \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "15551234567",
    "type": "text",
    "text": {
      "body": "Your appointment is confirmed."
    }
  }'
```
