Badges API
You can manage badges via API
Required Headers for all API endpoints
Regional endpoints: Replacechatbackend.watchers.iowith the endpoint matching your project region. See Supported Regions for details.
Region Endpoint Europe (default) chatbackend.watchers.ioNorth America chatbackend.us.watchers.ioSouth America chatbackend.sa.watchers.ioAsia chatbackend.hk.watchers.ioAfrica chatbackend.za.watchers.io
| Parameter | Description |
|---|---|
| x-api-key | Your public API key used for the project |
| Authorization | Bearer token what you can get from the back office (Admin panel / Settings / Bearer tokens) for back-to-back integrations |
Create new badge
POST Endpoint https://chatbackend.watchers.io/external/badge
Request payload
Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Text on badge. Better use not more than 10-12 characters, and also use emoji. (Not limited) |
| string | Yes | HEX Color of badge |
| string | Yes | HEX Color of text |
| string | Yes | Short description for badge. |
| string | Yes | The message image that the user will see when entering the chat when he has been assigned this badge.
|
| string | Yes | The message title that the user will see when entering the chat when he has been assigned this badge. |
| string | Yes | The message text that the user will see when entering the chat when he has been assigned this badge. |
| string | No | URL of the badge image/icon. |
| string | No | Arbitrary data associated with the badge (stored as text). |
| object | No | Automatic badge assignment trigger configuration. See Badge Triggers for details. |
CURL example
curl --location -X POST 'https://chatbackend.watchers.io/external/badge' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${Bearer token from admin panel}' --header 'x-api-key: ${API KEY}' --data '{
"text": "best",
"backgroundColor": "#ea00fc",
"textColor": "#000000",
"tooltip": "5555",
"communicationPic": null,
"communicationText": "11111",
"communicationTitle": "11111"
}'Example response
{
"id": 3,
"text": "best",
"backgroundColor": "#ea00fc",
"textColor": "#000000",
"tooltip": "5555",
"pic": null,
"data": null,
"communicationPic": null,
"communicationText": "11111",
"communicationTitle": "11111",
"chainId": null,
"chainPosition": null,
"chain": null,
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z"
}Update badge by id
PATCH Endpoint https://chatbackend.watchers.io/external/badge/:id
Request payload
Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Text on badge. Better use not more than 10-12 characters, and also use emoji. (Not limited) |
| string | Yes | HEX Color of badge |
| string | Yes | HEX Color of text |
| string | Yes | Short description for badge. |
| string | Yes | The message image that the user will see when entering the chat when he has been assigned this badge.
|
| string | Yes | The message title that the user will see when entering the chat when he has been assigned this badge. |
| string | Yes | The message text that the user will see when entering the chat when he has been assigned this badge. |
| string | No | URL of the badge image/icon. |
| string | No | Arbitrary data associated with the badge (stored as text). |
| object | No | Automatic badge assignment trigger configuration. See Badge Triggers for details. |
CURL example
curl --location -X PATCH 'https://chatbackend.watchers.io/external/badge/:id' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${Bearer token from admin panel}' --header 'x-api-key: ${API KEY}' --data '{
"text": "best100",
"backgroundColor": "#ea00fc",
"textColor": "#000000",
"tooltip": "5555",
"communicationPic": null,
"communicationText": "11111",
"communicationTitle": "11111"
}'Example response
trueGet list of all badges
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | No | Number of badges to return (default: 20) |
offset | number | No | Number of badges to skip for pagination (default: 0) |
order | string | No | Sort order, e.g. id_desc, id_asc (default: id_desc) |
CURL example
curl --location 'https://chatbackend.watchers.io/external/badge?limit=10&offset=0' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${Bearer token from admin panel}' --header 'x-api-key: ${API KEY}'Example response
[
{
"id": 1,
"text": "cool",
"backgroundColor": "#ea00fc",
"textColor": "",
"tooltip": "5555",
"pic": null,
"communicationPic": null,
"communicationText": "11111",
"communicationTitle": "11111",
"userCount": 1,
"trigger": {
"id": null,
"firstMessage": null,
"messageCount": null
}
}
]Get badge by id
CURL example
curl --location 'https://chatbackend.watchers.io/external/badge/:id' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${Bearer token from admin panel}' --header 'x-api-key: ${API KEY}'Example response
{
"id": 1,
"text": "cool",
"backgroundColor": "#ea00fc",
"textColor": "",
"tooltip": "5555",
"pic": null,
"data": null,
"communicationPic": null,
"communicationText": "11111",
"communicationTitle": "11111",
"chainId": null,
"chainPosition": null,
"chain": null,
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z"
}If the badge is part of a chain, the
chainfield will contain the full chain object with its nested badges.
Delete badge by id
CURL example
curl --location -X DELETE 'https://chatbackend.watchers.io/external/badge/:id' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${Bearer token from admin panel}' --header 'x-api-key: ${API KEY}'Example response
trueAssign badge to user by userid (Replace)
Request payload
| Parameter | Type | Required | Description |
|---|---|---|---|
userIds | array of strings | Yes | Example { "userIds": ["123","321"] } |
CURL example
curl --location -X POST 'https://chatbackend.watchers.io/external/badge/4/users' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${Bearer token from admin panel}' --header 'x-api-key: ${API KEY}' --data ' { "userIds": ["123","321"] }'Add badge to user by userid
| Parameter | Type | Required | Description |
|---|---|---|---|
userIds | array of strings | Yes | Example { "userIds": ["123","321"] } |
CURL example
curl --location -X POST 'https://chatbackend.watchers.io/external/badge/4/users/add' --header 'Content-Type: application/json' --header 'Authorization: Bearer ${Bearer token from admin panel}' --header 'x-api-key: ${API KEY}' --data '{ "userIds": ["123", "321"] }'{ "added": 2 }Remove badge to user by userid
| Parameter | Type | Required | Description |
|---|---|---|---|
userIds | array of strings | Yes | Example { "userIds": ["123","321"] } |
CURL example
curl --location -X POST 'https://chatbackend.watchers.io/external/badge/:badgeId/users/remove' { "userIds": string[] }'{ "removed": number }Updated about 1 month ago