Channel creation

The method is intended to create an instance for WhatsApp API

Create Channel

In order to create channels, you will need an API Token, which is displayed in the partner control panel

Create channels in order to connect them to WhatsApp

The required parameter is projectId. This is a kind of shell inside your account that groups channels.

In your service, you can independently distribute channels by projects. This will help organize channels the way you need.

To get main projectId, you can call API function: GET https://manager.whapi.cloud/projects

Get required parameter "projectId"

Now that we have this parameter, we can create the channel.

curl --request PUT \
     --url https://manager.whapi.cloud/channels \
     --header 'accept: application/json' \
     --header 'authorization: Bearer I6IkpXVCIsImtpZCI6Im......ExZDI2YWY' \
     --header 'content-type: application/json' \
     --data '
{
  "name": "Bot for Ukindo",
  "projectId": "kpSv3OFq9PkP1W1Ogv7p"
}
'

A successful response to your request will look like this:

{
  "apiUrl": "https://gate.whapi.cloud/",
  "id": "SHAZAM-3HDYQ", // ID of the new channel
  "creationTS": 1712598267389,
  "ownerId": "DdEBesOO62Ika8Q8d491Vse2kQp2", // Your account ID
  "activeTill": 1713116667448, // Date until which the channel will operate
  "token": "LK0tQ9qnb5pvfDDsj5NzeRFpnpApSEGb", // Channel Token. Save it!
  "server": 6,
  "stopped": false,
  "status": "active",
  "trial": 1713030267448,
  "mode": "trial", // Channel mode
  "name": "Bot for Ukindo",
  "projectId": "kpSv3OFq9PkP1W1Ogv7p"
}
Created channel in dashboard, ready to go.

Update channel webhook

Once you've created a channel, the best solution is to customize it right away, namely to set up links to your webhook address.

In this way you can immediately receive notifications about the channel status, about the authorization event of the user (i.e. his connection to the channel).

All details about detailed webhook settings can be found in the article: Detailed webhook settings

Set a webhook on the channel before the user connects to know the status of the channel

Of course, you will need the channel token that you received when you created the channel.

curl --request PATCH \
     --url https://gate.whapi.cloud/settings \
     --header 'accept: application/json' \
     --header 'authorization: Bearer 4sbdNB1cwpo2vVwBPbBmczBiShVDCXcs' \
     --header 'content-type: application/json' \
     --data '
{
  "webhooks": [
    {
      "events": [
        {
          "type": "users",
          "method": "post"
        },
        {
          "type": "channel",
          "method": "post"
        }
      ],
      "mode": "body",
      "url": "https://Your_Webhook_Address"
    }
  ],
  "callback_persist": true
}
'

Once the QR code is scanned by the user, you will receive a notification, about this event and the connected number:

With the USER webhook - you will instantly know when a user is connected.

Last updated

Was this helpful?