Skip to content

Channel-campaign assignment

Manages a template’s channel/campaign assignments. Multiple clients can share the same WABA, but each has independent assignments.

Endpoints:

MethodRoute
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

ParameterTypeRequiredDescription
messageTemplateIdstringYesTemplate ID (bspTemplate._id).

Body

FieldTypeRequiredDescription
client_idnumberNoClient. Requires BSP_CN if it differs from the token.
channel_campaignsarrayNoList 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 channel and campaign. All other fields are preserved identically (active, associatedFlow, dynamicPricing, headerType, highQuality, isDirectMessage, syncMeta, dates, etc.), including the original createdBy.

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

CodeCase
403client_id different from the token without BSP_CN
404Template not found
When deleting the operating client’s last assignment, an “Unassigned” placeholder is created/updated only for that client, leaving other clients’ assignments untouched.