Channel-campaign assignment
Manages a template’s channel/campaign assignments. Multiple clients can share the same WABA, but each has independent assignments.
Endpoints:
| Method | Route |
|---|---|
| GET | /v1/templates/{messageTemplateId}/channel-campaigns-grouped |
| POST | /v1/templates/{messageTemplateId}/channel-campaigns |
| PUT | /v1/templates/{messageTemplateId}/channel-campaigns |
| DELETE | /v1/templates/{messageTemplateId}/channel-campaigns |
Parameters
Path
| Parameter | Type | Required | Description |
|---|---|---|---|
messageTemplateId | string | Yes | Template ID (bspTemplate._id). |
Body
| Field | Type | Required | Description |
|---|---|---|---|
client_id | number | No | Client. Requires BSP_CN if it differs from the token. |
channel_campaigns | array | No | List of {channel_id, campaign_id}. |
List assignments grouped by campaign
curl --request GET \
--url 'https://api.chattigo.com/v1/templates/{messageTemplateId}/channel-campaigns-grouped' \
--header 'Authorization: Bearer <token>'The grouped GET returns an array of campaigns with their assigned channels (no wrapper). It excludes the “Unassigned” placeholder:
[
{
"campaign_id": 5,
"campaign_name": "Camp 1",
"channels": [
{ "channel_id": 10, "name": "ch10", "did": "5731...", "type": "WHATSAPP", "waba_id": "123456789012345" }
]
}
]name is only included when the channel has one; empty names are omitted from the object.
Create assignments (creates siblings)
curl --request POST \
--url 'https://api.chattigo.com/v1/templates/{messageTemplateId}/channel-campaigns' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"client_id": 6,
"channel_campaigns": [
{ "channel_id": 10, "campaign_id": 20 }
]
}'Exact copy: the new tuple (sibling) is a byte-exact copy of the original template, changing only
channelandcampaign. All other fields are preserved identically (active,associatedFlow,dynamicPricing,headerType,highQuality,isDirectMessage,syncMeta, dates, etc.), including the originalcreatedBy.
curl --request PUT \
--url 'https://api.chattigo.com/v1/templates/{messageTemplateId}/channel-campaigns' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"client_id": 6,
"channel_campaigns": [
{ "channel_id": 10, "campaign_id": 21 }
]
}'Delete assignment
curl --request DELETE \
--url 'https://api.chattigo.com/v1/templates/{messageTemplateId}/channel-campaigns?client_id=6' \
--header 'Authorization: Bearer <token>'Response
POST — Success (201)
{
"ids": ["664a1b2c3d4e5f6000000001", "664a1b2c3d4e5f6000000002"],
"success": true
}ids are the _id of each persisted document. The replaced “Unassigned” placeholder keeps its _id.
PUT / DELETE — Success (200)
{
"ids": null,
"success": true
}Errors
| Code | Case |
|---|---|
403 | client_id different from the token without BSP_CN |
404 | Template not found |