Labels

Create, edit and delete WhatsApp Business labels, and apply them to chats.

Labels organize chats in WhatsApp Business. These routes are under the Labels tag in the API Reference tab.

Labels only exist on WhatsApp Business numbers. On a regular number, GET /labels returns an empty list, and creating, editing or applying a label answers 422 etiquetas_indisponiveis.

Routes

RouteWhat it does
GET /labelsThe number's labels.
POST /labelsCreate a label with name and color. Answers 201.
PUT /labels/{labelId}Change a label's name and color (both).
DELETE /labels/{labelId}Delete a label. Chats that had it lose it.
GET /labels/{labelId}/chatsThe chats with this label.
GET /chats/{chatId}/labelsThe labels of a chat.
PUT /chats/{chatId}/labelsSet a chat's labels, replacing the whole set.

{labelId} is the id from GET /labels. {chatId} is a chat ID from GET /chats or a webhook, or a phone number with country code and area code.

Create a label

curl -X POST https://app.wappfy.io/api/v1/labels \
  -H "X-Api-Key: wpf_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "New customer", "color": 1 }'
{
  "data": { "id": "7", "name": "New customer", "color": 1, "color_hex": "#64c4ff" }
}
  • name: up to 100 characters.
  • color: WhatsApp's color index, from 0 to 19 (0 #ff9485, 1 #64c4ff, 2 #ffd429, 3 #dfaef0, 4 #99b6c1, 5 #55ccb3...). Store the index: color_hex is how WhatsApp shows it today and may change.
  • In rare cases id comes back null when WhatsApp didn't return it. Check GET /labels.

Label a chat

curl -X PUT https://app.wappfy.io/api/v1/chats/5581999999999/labels \
  -H "X-Api-Key: wpf_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "labels": ["1", "7"] }'

PUT /chats/{chatId}/labels replaces the whole set: labels you leave out are removed from the chat, and [] removes them all. To add one label, read the current ones first and send them all.

The response has the chat's labels after the change. GET /chats/{chatId}/labels may come from the short cache (Age header), so right after a PUT, trust the PUT response.

Label events

On your webhook: label.updated (created or edited; both look the same), label.deleted, label.chat.added and label.chat.removed.

On this page