Skip to main content
POST
/
v1
/
channels
/
{channelId}
/
connect
Connect Meta WhatsApp channel
curl --request POST \
  --url https://api.hubmessage.io/v1/channels/{channelId}/connect \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "wabaId": "428083093730937",
  "phoneId": "123456789012345",
  "code": "ABC123DEF456",
  "coexistence": false
}
'
{
  "success": true
}

Overview

After creating a channel of type META_WHATSAPP, you need to connect it to a WhatsApp Business number. There are two ways:
  • Via dashboard — Guided flow directly in the Dashboard
  • Via SDK + API — Integrate the connection flow into your system

Connection via dashboard

The simplest way. Go to the Dashboard, select the created channel and follow the guided connection flow.

Connection via SDK + API

Use this flow when you want your user to connect the channel from within your system, without needing to access the dashboard. The flow has 3 steps:
1

Frontend — Start connection with SDK

In your application’s frontend, use the SDK to start the connection flow. The SDK will open the WhatsApp authentication process and return the necessary information.
import HubMessage from '@hubmessage/connect';

const client = HubMessage.newClient({
  publicKey: 'YOUR_PUBLIC_KEY'
});

const response = await client.connect({
  channelId: 'CHANNEL_ID'
});

// Send the response to your backend
The publicKey can be exposed in the frontend. See more at Authentication.
2

Frontend → Backend — Send data

The SDK returns an object with the connection information. Send this data to your application’s backend:
{
  "wabaId": "428083093730937",
  "phoneId": "123456789012345",
  "code": "ABC123DEF456",
  "coexistence": false
}
FieldTypeDescription
wabaIdstringSelected WhatsApp Business Account ID
phoneIdstringSelected phone number ID
codestringAuthorization code generated by WhatsApp
coexistencebooleanWhether the number is in coexistence mode
3

Backend — Finalize connection via API

In the backend, call the connection API passing the data received from the frontend:POST /v1/channels/{channelId}/connect
curl -X POST https://api.hubmessage.io/v1/channels/CHANNEL_ID/connect \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -d '{
    "wabaId": "428083093730937",
    "phoneId": "123456789012345",
    "code": "ABC123DEF456",
    "coexistence": false
  }'
This call must be made in the backend, as it uses the Secret Key which should never be exposed in the frontend.

Flow summary

Frontend (SDK)              →  Backend (API)

1. client.connect()
2. User authenticates
3. SDK returns data -----→  4. POST /v1/channels/{id}/connect
                               with wabaId, phoneId, code, coexistence
                            5. Channel connected ✓
After connection, the channel is ready to send and receive messages. Use the channelId in the free messages and templates endpoints.

Authorizations

Authorization
string
header
required

Secret Key generated in the Hub Message Security panel

Path Parameters

channelId
string
required

Channel ID (obtained via Create channel)

Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

Body

application/json
wabaId
string
required

WhatsApp Business Account ID

phoneId
string
required

Phone number ID

code
string
required

Authorization code generated by WhatsApp

coexistence
boolean
required

Whether the number is in coexistence mode

Response

Channel connected successfully

success
boolean

Indicates whether the operation was successful