Auphere
Documentation menu

Auphere Embed · Guides

/ v0.1

Connecting WhatsApp

The self-serve flow where your client links their own WhatsApp Business number to their agent — Meta Embedded Signup, inside the Auphere iframe.

Each of your clients sends from their own WhatsApp Business number, not from a shared one. Linking that number is the only step in the whole flow that needs a human: someone with access to the client’s Meta Business account has to authorize it.

What the client needs

  • Access to their Meta Business account (the owner, or whoever manages it).
  • A phone number for WhatsApp Business — new, or migratable to the Cloud API.

Launching the flow

Call connectWhatsApp() from your settings or onboarding page. It opens Meta’s official Embedded Signup inside the Auphere iframe — the Meta login happens under our origin and Meta app configuration, never in your bundle.

ts
await auphere.connectWhatsApp({
  onConnected: ({ displayPhoneNumber }) => {
    // e.g. "+58 424-1234567" — refresh your UI here
  },
  onExit: () => {
    // modal closed (connected or not)
  },
});

What happens after authorization

  1. Auphere registers the number and subscribes to its webhook — messages start flowing through the client’s agent.
  2. Credentials are stored encrypted on our side. Nothing is returned to your frontend beyond the display phone number.
  3. If your blueprint has auto-activation enabled (the default), the client flips to active and their agent starts responding immediately.
  4. The broadcast button becomes available for that client.

Tracking connection status

The SDK keeps the last known status and exposes a small subscription API. On the server side, the mint response of POST /v1/widget-sessions also includes whatsapp.status, so you can decide server-side whether to render campaign UI at all.

ts
auphere.getStatus();          // "connected" | "not_connected" | "unknown"
await auphere.refreshStatus(); // re-mints a session and refreshes

const unsubscribe = auphere.onStatusChange((status) => {
  // fires on every flip, e.g. right after a successful signup
});