Labels
Labels are a WhatsApp Business feature that lets you categorize and organize your chats. Through the Wappfy API, you can create custom labels, assign them to chats, and retrieve chats by label.Labels are only available on WhatsApp Business accounts. Personal WhatsApp accounts do not support labels.
Create a Label
Create a new label with a name and color.Label Colors
WhatsApp Business supports a fixed set of label colors identified by number:| Color ID | Color |
|---|---|
0 | Light gray |
1 | Green |
2 | Blue |
3 | Yellow |
4 | Pink/Red |
List Labels
Retrieve all labels for the instance.Update a Label
Update an existing label’s name or color.Delete a Label
Permanently delete a label. This removes the label from all chats it was assigned to.Chat Labels
Get Labels for a Chat
Retrieve all labels assigned to a specific chat.Set Labels on a Chat
Assign one or more labels to a chat. This replaces any existing labels on the chat.Get Chats by Label
Retrieve all chats that have a specific label assigned.Common Use Cases
Tagging new leads automatically
Tagging new leads automatically
Use a webhook to listen for
message.received events. When a message comes from an unknown contact, assign the “New Lead” label via the API. This helps your team quickly identify and prioritize new conversations.Tracking support ticket status
Tracking support ticket status
Create labels like “Open”, “In Progress”, and “Resolved”. Update the label as your team works through support requests. Use the “Get Chats by Label” endpoint to build a simple support queue.
Segmenting customers for broadcasts
Segmenting customers for broadcasts
Label customers by category (e.g., “VIP”, “Wholesale”, “Retail”). When sending broadcast messages, fetch all chats for a label and send messages in a loop.
Endpoint Reference
| Method | Endpoint | Description |
|---|---|---|
POST | /api/instances/{id}/labels | Create a new label |
GET | /api/instances/{id}/labels | List all labels |
PUT | /api/instances/{id}/labels/{labelId} | Update a label |
DELETE | /api/instances/{id}/labels/{labelId} | Delete a label |
GET | /api/instances/{id}/labels/chats/{chatId} | Get labels for a chat |
PUT | /api/instances/{id}/labels/chats/{chatId} | Set labels on a chat |
GET | /api/instances/{id}/labels/{labelId}/chats | Get chats by label |
Error Handling
| Status Code | Description |
|---|---|
400 | Invalid label color or missing required fields. |
404 | Label or chat not found. |
409 | A label with the same name already exists. |
422 | Invalid chat ID format. |