Link Slack Channel to WhatsApp Group
This endpoint allows you to establish a connection between a Slack channel and a WhatsApp group. Once linked, messages sent in either platform will be synchronized to the other, creating a seamless communication bridge between Slack and WhatsApp.
Path Parameters
Field | Description | Required |
---|---|---|
slack_channel_id | The ID of the Slack channel to link | Yes |
group_uuid | The UUID of the WhatsApp group to link (format: WAG{36} or WGP{36}) | Yes |
Request Body
Field | Description | Required | Default |
---|---|---|---|
ignore_thread_messages | Whether to ignore thread messages in the synchronization | No | false |
display_slack_username_on_message | Whether to display the Slack username on messages sent to WhatsApp | No | true |
Invocation
- cURL
- Python
- NodeJS
curl -X POST \
'https://api.p.2chat.io/open/slack/C1234567890/link-to-group/WAG1234567890' \
-H 'X-User-API-Key: your_api_key_here' \
-H 'Content-Type: application/json' \
-d '{
"ignore_thread_messages": false,
"display_slack_username_on_message": true
}'
import requests
import json
url = "https://api.p.2chat.io/open/slack/C1234567890/link-to-group/WAG1234567890"
payload = json.dumps({
"ignore_thread_messages": False,
"display_slack_username_on_message": True
})
headers = {
'X-User-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({
"ignore_thread_messages": false,
"display_slack_username_on_message": true
});
var config = {
method: 'post',
url: 'https://api.2chat.io/open/slack/C1234567890/link-to-group/WAG1234567890',
headers: {
'X-User-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
The API will respond with the link details if the invocation succeeded.
{
"success": true,
"data": {
"slack_channel_id": "C1234567890",
"whatsapp_group_uuid": "WAG1234567890",
"channel_uuid": "WPN1234567890",
"ignore_thread_messages": false,
"display_slack_username_on_message": true
}
}
Error Responses
Status Code | Description |
---|---|
400 | Missing required fields: slack_channel_id, group_uuid are required |
404 | Account not found |
400 | Slack configuration not found |
400 | Slack channel not found |
400 | Slack configuration is disabled. Reason: {reason} |
404 | WhatsApp group not found. Received group_uuid=[group_uuid] |
400 | Slack channel is already linked to another WhatsApp group |