Skip to main content

Execute a command on a number

With this endpoint you can execute a command on a number you connected to 2Chat.

Parameters

You will need to know the UUID of the number you connected to 2Chat. You can get it using the List Numbers Endpoint.

The acceptable commands are the following and they must be part of the query path of the request. For example: https://api.p.2chat.io/open/whatsapp/channel/WPN.../connect

FieldDescription
connectTriggers a connect command to bring the number online with a QR Code.
disconnectDisconnects a connected number. This won't delete it from 2Chat.

Invocation

For the following examples, we will use WPNf3ea6c85-0dca-4d8a-a9a6-2b918f59cc97 as the UUID of the number we want to run commands on.

curl -X POST --location 'https://api.p.2chat.io/open/whatsapp/channel/WPNf3ea6c85-0dca-4d8a-a9a6-2b918f59cc97/connect' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here'

Response

If the command executed correctly, you will see the following response.

{
"success": true
}

To check the status of the number after you executed a command, you can do it with the Channel Status Endpoint.