मुख्य सामग्री पर जाएं

Labels

Labels एक WhatsApp Business feature है जो आपको अपने chats को categorize और organize करने की सुविधा देता है। Wappfy API के माध्यम से, आप custom labels बना सकते हैं, उन्हें chats पर assign कर सकते हैं, और label के अनुसार chats प्राप्त कर सकते हैं।
Labels केवल WhatsApp Business accounts पर उपलब्ध हैं। Personal WhatsApp accounts labels को support नहीं करते।
सभी label endpoints एक specific instance से जुड़े हैं:
/api/instances/{instanceId}/labels/...

एक Label बनाएं

एक name और color के साथ नया label बनाएं।
curl -X POST https://api.wappfy.io/api/instances/inst_abc123/labels \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "VIP Customer",
    "color": 1
  }'
Response:
{
  "data": {
    "id": "1",
    "name": "VIP Customer",
    "color": 1
  }
}

Label Colors

WhatsApp Business number द्वारा पहचाने जाने वाले label colors का एक निश्चित सेट support करता है:
Color IDColor
0हल्का ग्रे
1हरा
2नीला
3पीला
4गुलाबी/लाल

Labels की सूची

Instance की सभी labels प्राप्त करें।
curl https://api.wappfy.io/api/instances/inst_abc123/labels \
  -H "X-Api-Key: YOUR_API_KEY"
Response:
{
  "data": [
    { "id": "1", "name": "New Customer", "color": 0 },
    { "id": "2", "name": "VIP Customer", "color": 1 },
    { "id": "3", "name": "Pending Payment", "color": 3 },
    { "id": "4", "name": "Resolved", "color": 2 }
  ]
}

एक Label Update करें

किसी मौजूदा label का name या color update करें।
curl -X PUT https://api.wappfy.io/api/instances/inst_abc123/labels/2 \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Customer",
    "color": 2
  }'

एक Label Delete करें

एक label को स्थायी रूप से delete करें। यह label को उन सभी chats से हटा देता है जिन पर यह assign था।
curl -X DELETE https://api.wappfy.io/api/instances/inst_abc123/labels/2 \
  -H "X-Api-Key: YOUR_API_KEY"
किसी label को delete करने से वह सभी संबंधित chats से हट जाता है। यह action पूर्ववत नहीं किया जा सकता।

Chat Labels

किसी Chat के Labels प्राप्त करें

किसी specific chat पर assign किए गए सभी labels प्राप्त करें।
curl https://api.wappfy.io/api/instances/inst_abc123/labels/chats/[email protected] \
  -H "X-Api-Key: YOUR_API_KEY"
Response:
{
  "data": [
    { "id": "1", "name": "New Customer", "color": 0 },
    { "id": "3", "name": "Pending Payment", "color": 3 }
  ]
}

Chat पर Labels Set करें

एक chat पर एक या अधिक labels assign करें। यह chat पर मौजूदा किसी भी labels को replace कर देता है।
curl -X PUT https://api.wappfy.io/api/instances/inst_abc123/labels/chats/[email protected] \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label_ids": ["1", "2"]
  }'
किसी chat से सभी labels हटाने के लिए, एक empty array pass करें: {"label_ids": []}

Label के अनुसार Chats प्राप्त करें

किसी specific label assign किए गए सभी chats प्राप्त करें।
curl https://api.wappfy.io/api/instances/inst_abc123/labels/2/chats \
  -H "X-Api-Key: YOUR_API_KEY"
Response:
{
  "data": [
    {
      "chat_id": "[email protected]",
      "name": "Maria Silva"
    },
    {
      "chat_id": "[email protected]",
      "name": "Carlos Oliveira"
    }
  ]
}

सामान्य उपयोग के मामले

message.received events को सुनने के लिए webhook का उपयोग करें। जब किसी अज्ञात contact से message आए, तो API के माध्यम से “New Lead” label assign करें। यह आपकी team को नई बातचीत को तेजी से पहचानने और प्राथमिकता देने में मदद करता है।
“Open”, “In Progress”, और “Resolved” जैसे labels बनाएं। जैसे-जैसे आपकी team support requests पर काम करती है, label को update करें। एक simple support queue बनाने के लिए “Label के अनुसार Chats प्राप्त करें” endpoint का उपयोग करें।
Customers को category के अनुसार label करें (जैसे, “VIP”, “Wholesale”, “Retail”)। Broadcast messages भेजते समय, एक label के लिए सभी chats fetch करें और loop में messages भेजें।

Endpoint Reference

MethodEndpointविवरण
POST/api/instances/{id}/labelsनया label बनाएं
GET/api/instances/{id}/labelsसभी labels की सूची
PUT/api/instances/{id}/labels/{labelId}Label update करें
DELETE/api/instances/{id}/labels/{labelId}Label delete करें
GET/api/instances/{id}/labels/chats/{chatId}Chat के labels प्राप्त करें
PUT/api/instances/{id}/labels/chats/{chatId}Chat पर labels set करें
GET/api/instances/{id}/labels/{labelId}/chatsLabel के अनुसार chats प्राप्त करें

Error Handling

Status Codeविवरण
400अमान्य label color या आवश्यक fields गायब हैं।
404Label या chat नहीं मिला।
409समान name वाला label पहले से मौजूद है।
422अमान्य chat ID format।