Label Added to Chat
Triggered when a label is assigned to a specific conversation.
Best practices
Update the 'tags' or 'status' field for the contact/chat in your backend.
The Signal of Conversion: Mastering the Label-to-Chat Webhook
In the architecture of a high-performance sales and support engine, a tag is not just a label—it is a State Transition. The Label Added to Chat webhook is the primary signal that a human agent or an automated system has categorized a conversation into a specific operational phase. Whether a chat is marked as "Interested," "Payment Pending," or "VIP Support," the [label.chat.added] event provides your infrastructure with the real-time trigger required to move the customer through your internal Kanban or CRM pipeline.
This guide provides an architectural deep-dive into the strategic value of dynamic chat labeling, moving beyond "Tagging" into the realm of Automated Pipeline Orchestration and Lead-Scoring Logic.
🏗️ Architectural Philosophy: Labels as Pipeline Gates
To master the Label-to-Chat API, one must recognize that applying a label is an act of Intentional Classification.
1. The Interaction Identity (JIDs)
The mapping of a label to a chat is agnostic of the chat type:
- Individuals (@c.us): Tagging a 1-on-1 chat creates a personalized lead profile in your CRM.
- Groups (@g.us): Tagging a group chat categorizes the entire community (e.g., "Project Delta" or "Priority Partners").
Your system must use the [
chatId] in the payload to locate the target entity and the [labelId] to determine which specific "Bucket" the entity now belongs to.
2. The Relationship Between Meta and State
While the Label Upsert event defines what the label is (name/color), the [label.chat.added] event defines where the label is. A robust architecture treats the Upsert as a "Schema Update" and the Added event as a "Data Mutation."
🚀 Strategic Use Cases: Powering Automated Conversion Funnels
The Label-to-Chat webhook is the "Glue" that connects the human interaction on a phone with the automated processes in your backend.
1. Building the "WhatsApp Kanban" (Automated Pipeline Sync)
Many organizations use external tools like Trello, Pipedrive, or custom Kanban boards to track leads.
The Strategic Workflow: When an agent on a physical phone applies the "Qualified" label to a chat, Wawp fires the [label.chat.added] webhook. Your backend catches this and programmatically moves the corresponding card in your CRM from the "Lead" column to the "Opportunity" column. This ensures your sales dashboard is Always in Sync with the real-time actions of the front-line team, eliminating manual data entry.
2. Automated Drip-Sequence Triggers
Labels can act as "Switches" for automated marketing campaigns.
The Logic: If your system detects that a chat has been tagged with "Send Catalog," it can automatically trigger the send-pdf endpoint to deliver your latest product brochure to that [chatId]. This "Label-Triggered Automation" allows human agents to initiate complex bot flows with a single tap of a tag on their phone screen.
3. Escalation and Priority Routing
Use labels to denote "Escalated" status. The Use Case: When a support supervisor tags a chat as "High Priority," your system detects the change via the webhook and updates the metadata in your internal ticketing system. It can also trigger a Slack notification to the engineering team: "Urgent assistance required for [Contact Name]—tagged as High Priority." This turns a simple WhatsApp feature into a Cross-Platform Alerting Engine.
🛡️ Administrative Mandate: Scaling the Attribution Layer
Scaling labeling logic requires a focus on "Categorical Integrity."
1. The "Single Label" Policy vs. Multi-Tagging
WhatsApp allows multiple labels to be applied to a single chat.
The Strategic Rule: Decide how your CRM handles "Tag Overlap." Does your system treat the latest label as the primary status, or does it accumulate labels into an array of tags? We recommend an "Accumulative Model" for marketing segments and a "Single-Truth Model" for pipeline stages. The [label.chat.added] event provides the IDs you need to maintain whichever model fits your business logic.
2. Monitoring Agent Productivity and Accuracy
By logging every [label.chat.added] event with its timestamp, you can measure the "Time-to-Label"—the gap between the first message and the moment the lead was qualified.
The Data Insight: If an agent takes 4 hours to label a lead, it indicates a bottleneck in your triage process. If they label 50 chats as "Spam" in 5 minutes, it may indicate a data-quality issue or a need for better automated filtering. This webhook is a vital tool for Operational Quality Control.
🛡️ Operational Best Practices: Optimizing the State Loop
- Coordinate with label.chat.deleted: A chat can move out of a category by having the label removed. To maintain an accurate count of "Live Leads" in your CRM, your system must listen to the Label Deleted from Chat event to clear the corresponding tag in your database.
- The "Shadow State" Warning: Note that labels are sometimes applied before the first message is received (e.g., from a prior contact). Your system should be prepared to handle a [
label.chat.added] event for a [chatId] that doesn't yet have a message history in your logs. - Visual Reassurance: If your custom dashboard has its own tagging UI, ensure that any label added via the Wawp API also triggers the same "Success" visuals as a manual tag. This keeps the experience consistent for the user.
⚙️ Engineering Best Practices: The Validation Loop
- Strict ID Mapping: Always resolve the [
labelId] using your latest cached data from the label.upsert stream. Never hardcode label IDs, as they can change between different WhatsApp Business instances. - Verify Asset Consistency: If a label is added to a Group (
@g.us), ensure your code updates the metadata for the Group Entity rather than a specific individual. - Handle "Mass Tagging" Scenarios: Some WhatsApp engines allow "Bulk Labeling" (tagging 10 chats at once). Your webhook handler should be designed to receive and process these as atomic, high-speed events.
🎯 Conclusion: The Rhythm of Classification
The Label Added to Chat Webhook is the "Pulse of Progress" for your digital brand. By building an architecture that listens, automates, and synchronizes these categorical shifts, you move your organization from "Reactive Chatting" to Structured Revenue Management. You build systems that understand the stage of every lead, automate the delivery of resources, and maintain a high-fidelity pipeline between the WhatsApp interface and your corporate brain. In the world of Wawp, a label is not just a tag—it is the strategic signal that drives your business forward.
Expected Responses
Explore all possible responses and outcomes from the server. We have documented each status code with data examples to make success and error handling easier.
Example
{
"id": "evt_01...",
"timestamp": 1634567890123,
"session": "default",
"metadata": {
"user.id": "123",
"user.email": "email@example.com"
},
"engine": "WEBJS",
"event": "label.chat.added",
"payload": {
"chatId": "11111111111@c.us",
"labelId": "1"
},
"me": {
"id": "11111111111@c.us",
"lid": "123@lid",
"pushName": "Instance"
}
}Command Palette
Search for a command to run...