पहचानें कि WhatsApp ग्राहक किसी व्यक्ति से बात करना चाहता है, सारांश के साथ चैट अपनी टीम को सौंपें, उसे असाइन करें, जब तक कोई व्यक्ति जवाब दे रहा है तब तक हर बॉट और AI जवाब को चुप रखें, और सुलझ जाने पर उसे बॉट को लौटा दें।
बॉट सरल सवालों पर तेज़ होता है। कुछ चैट को किसी व्यक्ति की ज़रूरत होती है: रिफ़ंड, शिकायत, गड़बड़ हुआ ऑर्डर, या ऐसा ग्राहक जो बस लिख देता है "can I talk to someone?"।
इस गाइड में आपका बॉट ऐसी चैट अपनी टीम को सौंपता है, और टीम का काम पूरा होने पर उसे वापस ले लेता है।
ग्राहक को क्या दिखता है: वे किसी व्यक्ति के लिए कहते हैं, और बॉट जवाब देता है "Thanks! A person from our team will answer you here soon." उसके बाद केवल आपकी टीम जवाब देती है, उसी WhatsApp चैट में। बीच में कोई बॉट जवाब या AI जवाब नहीं आता।
आपको क्या दिखता है: app2email Inbox में वह चैट, आपकी टीम के एक व्यक्ति को असाइन की हुई, एक आंतरिक नोट के साथ जो बताता है कि बॉट ने उसे क्यों सौंपा और ग्राहक ने क्या पूछा। हर बदलाव के लिए आपके webhook को एक इवेंट मिलता है: चैट का owner कौन है, वह किसे असाइन है, और वह कब सुलझी।
हर बातचीत (हर संपर्क की एक) का एक owner होता है। owner बताता है कि अभी उस संपर्क को कौन जवाब देता है। आप इसे एक कॉल से सेट करते हैं, PUT /conversations/{contact}/owner:
owner | मतलब | क्या होता है |
|---|---|---|
"" (खाली) | सामान्य रूटिंग | नंबर का ऑटो रिप्लाई, चैट ऑटोमेशन, AI जवाब और A2A / OpenClaw एजेंट वैसे काम करते हैं जैसा आपने सेट किया है। |
agent | कोई ऑटोमेशन इसका owner है | बाकी सबके लिए एक निशान: "कोई ऑटोमेशन इस संपर्क को संभाल रहा है"। AI जवाब चुप रहते हैं, क्योंकि वे केवल उसी बातचीत का जवाब देते हैं जिसका कोई owner नहीं है। |
human | कोई व्यक्ति owner है | app2email का ऑटो रिप्लाई और A2A / OpenClaw एजेंट संपर्क को छोड़ देते हैं, और AI जवाब भी। आपकी टीम जवाब देती है। |
paused | स्वचालित जवाब रोके गए हैं | ऑटो रिप्लाई, A2A / OpenClaw एजेंट और AI जवाबों के लिए human जैसा ही। |
owner कोई भी हो, ईमेल फ़ॉरवर्डिंग जारी रहती है, इसलिए जिन लोगों को WhatsApp मैसेज ईमेल से मिलते हैं उन्हें वे मिलते रहते हैं।
इस गाइड में हैंडओवर ऐसे काम करता है:
message.received मिलता है।GET /conversations/{contact})। अगर कोई व्यक्ति पहले से उसका owner है, तो बॉट कुछ नहीं करता।reason और summary के साथ owner को human सेट करता है, ग्राहक को बताता है कि कोई व्यक्ति जवाब देगा, चैट को टीम के किसी व्यक्ति को असाइन करता है और एक आंतरिक नोट जोड़ता है।"" कर देता है और अगले मैसेज का फिर से जवाब देता है। until_minutes भी तय समय के बाद चैट अपने आप लौटा सकता है।आपके webhook को नंबर का हर इवेंट मिलता रहता है, उस चैट का message.received भी जिसका owner कोई व्यक्ति है। app2email का अपना ऑटो रिप्लाई, A2A / OpenClaw एजेंट और AI जवाब owner को खुद जांचते हैं। आपके अपने बॉट को भी इसे जांचना होगा, हर जवाब से पहले।
plan_not_allowed आता है; रुकी हुई सेवा पर 403 service_not_live। देखें शुरू करना।POST /webhooks, signing secret)। यह गाइड उसमें हैंडओवर जोड़ती है।| Scope | यहां यह किसलिए है |
|---|---|
messages:send | owner सेट करना (PUT /conversations/{contact}/owner), चैट असाइन करना (PUT /conversations/{contact}/assignee), उसे सुलझा हुआ चिह्नित करना (PUT /conversations/{contact}/status), नोट जोड़ना (POST /conversations/{contact}/notes), ग्राहक को मैसेज भेजना (POST /messages) |
messages:read | एक बातचीत पढ़ना (GET /conversations/{contact}), बातचीतों की सूची, टीम (GET /team/members) और नोट |
webhooks:manage | webhook को एक बार रजिस्टर करना (POST /webhooks), या उसे API key पेज पर जोड़ना |
team_inbox_not_in_plan देते हैं; owner खुद हर सशुल्क प्लान पर काम करता है।आज़माना। तुरंत मिलने वाला sandbox बिना अकाउंट के चलता है: POST https://api.app2email.com/v1/account/sandbox (बिना key, बिना body) या Management MCP सर्वर https://api.app2email.com/mcp/manage का create_sandbox टूल डेमो नंबर 12025550100 की key देता है। इसका नकली ग्राहक 12025550105 किसी व्यक्ति को मांगता है, इसलिए आप पहचान को जांच सकते हैं। तुरंत मिलने वाले sandbox में PUT /conversations/{contact}/owner, GET /conversations, POST /messages और GET /events हैं (इवेंट वहीं पढ़ें, उसमें webhooks नहीं हैं)। टीम वाले कॉल (members, assignee, status, notes) वहां 403 not_in_instant_sandbox देते हैं। विवरण: Sandbox।
अपने नंबर पर sandbox key WhatsApp को कुछ नहीं भेजती, लेकिन owner, assignee, status और नोट आपकी बातचीतों में असली बदलाव हैं, sandbox key के साथ भी। इन कॉल को अपने ही किसी संपर्क पर आज़माएं, जैसे आपका अपना फ़ोन।
हर रिक्वेस्ट में YOUR_NUMBER वह WhatsApp नंबर है जिससे आप भेजते हैं: पहले देश कोड, सिर्फ़ अंक। संपर्क ग्राहक का नंबर (पहले देश कोड) या उसका business-scoped user id (जैसे AU.1234567890123456) है, यानी इवेंट का from या from_user_id।
GET /conversations/{contact} (scope messages:read) आपको owner बताता है, कि अभी free-form जवाब भेजा जा सकता है या नहीं, और कि ईमेल जवाब इंतज़ार में हैं या नहीं। इसे अपने बॉट के हर जवाब से पहले कॉल करें।
curl https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678 \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678", {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
const conv = await res.json();
console.log(conv.owner, conv.window_open);import os, requests
res = requests.get("https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}"}, timeout=10)
conv = res.json()
print(conv.get("owner"), conv.get("window_open"))जवाब में आपको क्या मिलता है (ऐसी चैट जिसका owner कोई व्यक्ति है):
{
"success": true,
"request_id": "c9slm",
"contact": "61412345678",
"identity_type": "phone",
"phone": "61412345678",
"name": "John",
"window_state": "open",
"window_open": true,
"window_closes_at": "2026-11-22T01:05:44Z",
"last_inbound_at": "2026-11-21T01:20:44Z",
"last_outbound_at": "2026-11-21T01:12:09Z",
"messages": 12,
"owner": "human",
"owner_set_at": "2026-11-21T01:21:00Z",
"owner_set_by": "api:Support bot",
"owner_reason": "customer asked for a person",
"owner_summary": "Wants to move the delivery to Monday.",
"held_replies": false,
"conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_..."
}| फ़ील्ड | यह आपके बॉट को क्या बताता है |
|---|---|
owner | "" सामान्य रूटिंग, agent, human या paused। जवाब केवल तब दें जब यह "" हो (या agent, अगर agent आपके अपने बॉट का निशान है) |
owner_set_by | इसे किसने सेट किया, जैसे api:Support bot (key का नाम) |
owner_reason, owner_summary | हैंडओवर के साथ क्या दिया गया |
owner_until | अस्थायी owner कब खत्म होता है। बीता हुआ समय फिर से "" के बराबर है |
owner_set | क्या सेट किया गया था, owner_until बीत जाने पर भी |
window_state, window_open | open: अभी free-form जवाब भेजा जा सकता है। closed: केवल मंज़ूर टेम्पलेट |
window_closes_at | विंडो ठीक कब बंद होती है |
held_replies | true: ईमेल जवाब इंतज़ार में हैं कि संपर्क "Show reply" पर टैप करे, क्योंकि 24 घंटे की विंडो बंद हो चुकी थी |
जिस फ़ील्ड का कोई मान नहीं होता, वह जवाब से छोड़ दिया जाता है, इसलिए सामान्य रूटिंग वाली चैट में हो सकता है कि कोई owner_* फ़ील्ड बिल्कुल न हो। जिस संपर्क ने कभी नहीं लिखा, उस पर 404 conversation_not_found आता है।
आपका बॉट यह message.received इवेंट से तय करता है। तीन संकेत अच्छे काम करते हैं:
type interactive और interactive.id के साथ आता है।reply बटन पर टैप ऐसे आता है:
{
"id": "evt_Pa3k9m2Lw8Rt5Yp1Zs012",
"type": "message.received",
"created": "2026-11-21T01:20:44.000Z",
"number": "4976659348270",
"data": {
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
"from": "61412345678",
"from_user_id": "AU.1234567890123456",
"name": "John",
"type": "interactive",
"text": "Talk to a person",
"interactive": {
"type": "button_reply",
"id": "person",
"title": "Talk to a person"
},
"conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_SAMPLEk3XbQ9rTzP2mW",
"timestamp": "2026-11-21T01:20:44.000Z"
}
}बटन खुद एक सामान्य interactive मैसेज है, जो 24 घंटे की विंडो के भीतर भेजा जाता है:
{
"to": "61412345678",
"type": "interactive",
"interactive": {
"type": "button",
"body": { "text": "What would you like to do?" },
"action": {
"buttons": [
{ "type": "reply", "reply": { "id": "track", "title": "Track my order" } },
{ "type": "reply", "reply": { "id": "person", "title": "Talk to a person" } }
]
}
}
}अपने बॉट के बजाय AI जवाब (app2email का असिस्टेंट) इस्तेमाल कर रहे हैं? वह इसे खुद पहचानता है और चैट सौंप देता है: देखें AI जवाब खुद चैट सौंपते हैं।
"owner": "human" के साथ PUT /conversations/{contact}/owner (scope messages:send):
| फ़ील्ड | ज़रूरी | क्या डालें |
|---|---|---|
owner | हां | human। साथ ही agent, paused, या सामान्य पर लौटने के लिए "" |
reason | नहीं | क्यों, कुछ शब्दों में (200 अक्षर तक), जैसे customer asked for a person |
summary | नहीं | चैट अब तक किस बारे में है, कार्यभार लेने वाले व्यक्ति के लिए (2000 अक्षर तक)। जो लोग WhatsApp मैसेज ईमेल से पढ़ते हैं, उन्हें भी यह मिलता है |
until_minutes | नहीं | 1 से 43200। इतने मिनट बाद owner अपने आप "" हो जाता है |
curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/owner \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"owner": "human", "reason": "customer asked for a person", "summary": "Wants to move the delivery to Monday.", "until_minutes": 480}'const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/owner", {
method: "PUT",
headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
owner: "human",
reason: "customer asked for a person",
summary: "Wants to move the delivery to Monday.",
until_minutes: 480,
}),
});
console.log(res.status, await res.json());res = requests.put(
"https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/owner",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
json={"owner": "human", "reason": "customer asked for a person",
"summary": "Wants to move the delivery to Monday.", "until_minutes": 480},
timeout=10,
)
print(res.status_code, res.json())जवाब में आपको क्या मिलता है (200): अपडेट की गई बातचीत, चरण 1 जैसे ही फ़ील्ड के साथ।
{
"success": true,
"request_id": "own3r",
"conversation": {
"contact": "61412345678",
"identity_type": "phone",
"phone": "61412345678",
"name": "John",
"window_state": "open",
"window_open": true,
"window_closes_at": "2026-11-22T01:05:44Z",
"messages": 12,
"owner": "human",
"owner_set": "human",
"owner_set_at": "2026-11-21T01:21:00Z",
"owner_set_by": "api:Support bot",
"owner_reason": "customer asked for a person",
"owner_summary": "Wants to move the delivery to Monday.",
"owner_until": "2026-11-21T09:21:00Z",
"held_replies": false,
"conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_..."
}
}अब से app2email का ऑटो रिप्लाई, A2A / OpenClaw एजेंट और AI जवाब इस संपर्क को छोड़ देते हैं, और नंबर के हर webhook को conversation.owner_changed मिलता है। वही owner दोबारा सेट करना हानिरहित है, इसलिए इस कॉल को दोबारा भेजना सुरक्षित है।
until_minutes को अपने खुलने के समय के अनुसार चुनें। 480 (8 घंटे) के साथ, जिस चैट को किसी ने नहीं उठाया वह अपने आप बॉट के पास लौट जाती है। इसे छोड़ दें तो चैट तब तक आपकी टीम के पास रहती है जब तक कोई उसे वापस न दे।
जब तक 24 घंटे की विंडो खुली है (window_open true है, और है, क्योंकि ग्राहक ने अभी लिखा), POST /messages से एक छोटा free-form टेक्स्ट भेजें। उसे ग्राहक के message_id से बनी Idempotency-Key दें, ताकि दोबारा कोशिश पर वह दो बार न जाए।
curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: handoff-wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=" \
-d '{"to": "61412345678", "type": "text", "text": {"body": "Thanks! A person from our team will answer you here soon."}}'await fetch("https://api.app2email.com/v1/YOUR_NUMBER/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": `handoff-${messageId}`,
},
body: JSON.stringify({
to: "61412345678",
type: "text",
text: { body: "Thanks! A person from our team will answer you here soon." },
}),
});requests.post(
"https://api.app2email.com/v1/YOUR_NUMBER/messages",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}", "Idempotency-Key": f"handoff-{message_id}"},
json={"to": "61412345678", "type": "text",
"text": {"body": "Thanks! A person from our team will answer you here soon."}},
timeout=10,
)जवाब में आपको क्या मिलता है (200):
{
"success": true,
"request_id": "kxrkf",
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTgA",
"status": "accepted",
"type": "text",
"from": "4976659348270",
"to": "61412345678",
"window_closes_at": "2026-11-22T01:05:44Z",
"conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_..."
}विंडो बंद हो गई? तब भेजने पर 422 outside_24h_window आता है और ग्राहक तक केवल मंज़ूर टेम्पलेट पहुंच सकता है।
GET /team/members (scope messages:read) बताता है कि कौन बातचीत ले सकता है: नंबर का owner और वे सदस्य जो जवाब दे सकते हैं (viewers को असाइन नहीं किया जा सकता)।
curl https://api.app2email.com/v1/YOUR_NUMBER/team/members \
-H "Authorization: Bearer YOUR_API_KEY"जवाब में आपको क्या मिलता है:
{
"success": true,
"request_id": "t3amx",
"members": [
{ "user_id": "a8d2k4m6p1q3r5s", "name": "Ava", "email": "ava@example.com", "role": "owner", "away": false, "in_rotation": false },
{ "user_id": "k3x9q2m7p4z8w1v", "name": "Ben", "email": "ben@example.com", "role": "member", "away": false, "in_rotation": true }
],
"count": 2,
"auto_assign": "round_robin"
}away: true का मतलब है कि ऑटो-असाइन नियम फ़िलहाल उस व्यक्ति को छोड़ देता है; in_rotation: true का मतलब है कि round robin उन्हें बातचीतें देता है।
फिर PUT /conversations/{contact}/assignee (scope messages:send)। assignee में यह दिया जा सकता है:
user_id या एक email,"auto": नंबर का ऑटो-असाइन नियम चुनता है (चुने गए सदस्यों में round robin, या वापस उस व्यक्ति को जिसने आखिरी बार जवाब दिया)। नियम off हो तो कुछ नहीं बदलता,"": कोई नहीं।curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/assignee \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assignee": "auto"}'const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/assignee", {
method: "PUT",
headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ assignee: "auto" }), // or "k3x9q2m7p4z8w1v", or "ben@example.com"
});
console.log(await res.json());res = requests.put(
"https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/assignee",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
json={"assignee": "auto"}, # or "k3x9q2m7p4z8w1v", or "ben@example.com"
timeout=10,
)
print(res.json())जवाब में आपको क्या मिलता है:
{
"success": true,
"request_id": "as1gn",
"conversation": {
"contact": "61412345678",
"conversation_id": 1234,
"name": "John",
"assignee": "k3x9q2m7p4z8w1v",
"assignee_name": "Ben",
"assigned_at": "2026-11-21T01:21:01.000Z",
"assigned_by": "auto",
"status": "open",
"status_at": null,
"status_by": null
}
}Ben को पुश अलर्ट मिलता है (अगर उन्होंने अलर्ट चालू किए हैं), Inbox में एक गतिविधि पंक्ति दिखती है जैसे API (Support bot) assigned this to Ben, और हर webhook को conversation.assigned मिलता है।
owner और assignee दो अलग फ़ील्ड हैं: owner बताता है कि स्वचालित जवाब दूर रहेंगे या नहीं, assignee बताता है कि टीम के किस व्यक्ति के पास चैट है।
POST /conversations/{contact}/notes (scope messages:send) एक आंतरिक नोट जोड़ता है: टीम उसे Inbox थ्रेड में पीले नोट के रूप में देखती है, मैसेज के साथ समय के क्रम में। ग्राहक इसे कभी नहीं देखता। 1 से 4000 अक्षर।
curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/notes \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Bot handover: customer asked for a person. Order 1234, wants to move the delivery to Monday."}'await fetch("https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/notes", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ text: "Bot handover: customer asked for a person. Order 1234, wants to move the delivery to Monday." }),
});requests.post(
"https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/notes",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
json={"text": "Bot handover: customer asked for a person. Order 1234, wants to move the delivery to Monday."},
timeout=10,
)जवाब में आपको क्या मिलता है:
{
"success": true,
"request_id": "n0te1",
"contact": "61412345678",
"conversation_id": 1234,
"note": {
"id": 88,
"kind": "note",
"text": "Bot handover: customer asked for a person. Order 1234, wants to move the delivery to Monday.",
"actor": "api:Support bot",
"actor_name": "API (Support bot)",
"assignee": null,
"assignee_name": null,
"at": "2026-11-21T01:21:02.000Z"
}
}नोट idempotent नहीं है: दोबारा कोशिश करने पर दूसरा जुड़ जाता है। इसे हर हैंडओवर में एक बार जोड़ें (नीचे का कोड इसे owner सेट होने के बाद जोड़ता है, और दोबारा कोशिश नहीं करता)।
POST /messages के ज़रिए।owner पढ़ता है और जब तक वह human या paused है, कुछ नहीं करता।a2a.respect_owner पर निर्भर है (डिफ़ॉल्ट रूप से चालू; GET /settings/number इसे दिखाता है)।GET /conversations/{contact} में held_replies true रहता है। विंडो के बाद चैट को फिर से केवल मंज़ूर टेम्पलेट शुरू करता है।GET /conversations?assignee=k3x9q2m7p4z8w1v&status=open (scope messages:read) एक व्यक्ति की खुली चैट की सूची देता है; assignee=none बिना असाइन वाली चैट की। हर प्रविष्टि में owner (सामान्य रूटिंग के लिए छोड़ा गया), assignee, assignee_name, status और window_open होते हैं।
तीन तरीके हैं, और आप सभी इस्तेमाल कर सकते हैं:
PUT /conversations/{contact}/owner और "owner": "" से। कोई व्यक्ति डैशबोर्ड पर भी owner बदल सकता है (तब इवेंट में set_by dashboard होता है)।until_minutes से। उसके बाद owner फिर से "" पढ़ा जाता है और owner_set अब भी दिखाता है कि क्या सेट किया गया था।"status": "solved" के साथ PUT /conversations/{contact}/status (या Inbox में "Solved") conversation.status_changed भेजता है; आपका बॉट इस पर owner को वापस "" करके प्रतिक्रिया देता है।# Mark it solved (it leaves the Inbox's Open view)
curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/status \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "solved"}'
# Back to normal routing: the bot answers again
curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678/owner \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"owner": "", "reason": "solved by the team"}'const headers = { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" };
const base = "https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678";
await fetch(`${base}/status`, { method: "PUT", headers, body: JSON.stringify({ status: "solved" }) });
await fetch(`${base}/owner`, { method: "PUT", headers, body: JSON.stringify({ owner: "", reason: "solved by the team" }) });base = "https://api.app2email.com/v1/YOUR_NUMBER/conversations/61412345678"
headers = {"Authorization": f"Bearer {os.environ['API_KEY']}"}
requests.put(f"{base}/status", headers=headers, json={"status": "solved"}, timeout=10)
requests.put(f"{base}/owner", headers=headers, json={"owner": "", "reason": "solved by the team"}, timeout=10)status कॉल से आपको क्या मिलता है:
{
"success": true,
"request_id": "s0lvd",
"conversation": {
"contact": "61412345678",
"conversation_id": 1234,
"name": "John",
"assignee": "k3x9q2m7p4z8w1v",
"assignee_name": "Ben",
"assigned_at": "2026-11-21T01:21:01.000Z",
"assigned_by": "auto",
"status": "solved",
"status_at": "2026-11-21T02:15:00.000Z",
"status_by": "api:Support bot"
}
}संपर्क का नया मैसेज सुलझी हुई बातचीत को अपने आप फिर खोल देता है (by contact के साथ conversation.status_changed)। जवाब भेजने से status नहीं बदलता।
किसी व्यक्ति से चैट अपने आप वापस न लें। उसे केवल ऐसे संकेत पर लौटाएं जिस पर आपकी टीम सहमत है (सुलझ गई, तय समय, या किसी व्यक्ति का अपना फ़ैसला)। owner_set_by बताता है कि owner किसने सेट किया।
यह API से WhatsApp चैटबॉट बनाएं के बॉट में हैंडओवर जोड़ता है। यह हस्ताक्षर जांचता है, जिन इवेंट को संभाल चुका है उन्हें छोड़ देता है, जब तक कोई व्यक्ति चैट का owner है चुप रहता है, मांगने पर चैट सौंपता है, और टीम के उसे सुलझा हुआ चिह्नित करने पर चैट लौटा देता है। पहले NUMBER (आपका WhatsApp नंबर, अंक), API_KEY और WEBHOOK_SECRET (आपके webhook का whsec_... मान) सेट करें।
// Node.js 18 or newer. npm install express then node handoff.mjs
import crypto from "node:crypto";
import express from "express";
const { NUMBER, API_KEY, WEBHOOK_SECRET, PORT = 3000 } = process.env;
const API = `https://api.app2email.com/v1/${NUMBER}`;
const ASKS_FOR_PERSON = /\b(human|person|someone|staff|manager)\b/i;
const done = new Set(); // handled event ids: use a database table or Redis in production
function verify(raw, header, secret) {
const t = /(?:^|,)\s*t=(\d+)/.exec(header ?? "")?.[1];
const v1 = [...(header ?? "").matchAll(/(?:^|,)\s*v1=([0-9a-f]+)/g)].map((m) => m[1]); // two during a secret change
if (!t || v1.length === 0 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(t + ".").update(raw).digest("hex");
return v1.some((v) => v.length === expected.length && crypto.timingSafeEqual(Buffer.from(v), Buffer.from(expected)));
}
async function api(method, path, body, idempotencyKey) {
for (let attempt = 1; ; attempt++) {
const res = await fetch(API + path, {
method,
signal: AbortSignal.timeout(4000),
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json",
...(idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}) },
body: body ? JSON.stringify(body) : undefined,
});
const json = await res.json();
if (res.ok) return json;
const code = json.error?.code;
const wait = Number(res.headers.get("Retry-After") ?? 1);
if (code === "rate_limited" && attempt < 3 && wait <= 3) { await new Promise((r) => setTimeout(r, wait * 1000)); continue; }
if (res.status >= 500 || res.status === 429) throw new Error(`${code} ${json.request_id}`);
console.warn(method, path, code, json.error?.how_to_fix, json.request_id);
return json;
}
}
const later = (promise, what) => promise.catch((err) => console.error(`${what} failed:`, err.message));
function wantsPerson(m) {
return m.interactive?.id === "person" || m.button?.payload === "person" ||
(m.type === "text" && ASKS_FOR_PERSON.test(m.text ?? ""));
}
async function handOver(m, conv) {
const to = m.from || m.from_user_id;
const contact = encodeURIComponent(to);
const reason = "customer asked for a person";
const summary = `${conv.name ?? "The customer"} wrote: "${(m.text ?? "").slice(0, 300)}"`;
// 1. The owner first: from now on no automatic answer reaches this contact. A failure here is retried.
await api("PUT", `/conversations/${contact}/owner`, { owner: "human", reason, summary, until_minutes: 480 });
// 2. The rest is best effort: logged, never retried, so nothing is done twice.
if (conv.window_open) {
await later(api("POST", "/messages", { to, type: "text",
text: { body: "Thanks! A person from our team will answer you here soon." } }, `handoff-${m.message_id}`), "message");
}
await later(api("PUT", `/conversations/${contact}/assignee`, { assignee: "auto" }), "assign");
await later(api("POST", `/conversations/${contact}/notes`, { text: `Bot handover: ${reason}. ${summary}` }), "note");
}
async function onMessage(m) {
const contact = encodeURIComponent(m.from || m.from_user_id);
const conv = await api("GET", `/conversations/${contact}`);
if (conv.owner && conv.owner !== "agent") return; // a person has it, or it is paused: stay quiet
if (wantsPerson(m)) return handOver(m, conv);
// ... your bot's normal answer goes here (see the chatbot guide)
}
async function onSolved(d) {
const contact = encodeURIComponent(d.contact);
const conv = await api("GET", `/conversations/${contact}`);
if (conv.owner === "human") {
await api("PUT", `/conversations/${contact}/owner`, { owner: "", reason: "solved by the team" });
}
}
const app = express();
app.post("/webhook", express.raw({ type: "application/json" }), async (req, res) => {
if (!verify(req.body, req.get("X-App2email-Signature"), WEBHOOK_SECRET)) return res.sendStatus(401);
const event = JSON.parse(req.body);
if (event.test || done.has(event.id)) return res.sendStatus(200);
try {
const d = event.data;
if (event.type === "message.received") await onMessage(d);
if (event.type === "conversation.status_changed" && d.status === "solved") await onSolved(d);
if (event.type === "conversation.owner_changed") {
console.log(`${d.contact}: ${d.previous_owner || "normal"} -> ${d.owner || "normal"} (${d.set_by ?? "?"})`);
}
if (event.type === "ai.handover") console.log(`AI handed ${d.contact} to the team: ${d.reason}`);
done.add(event.id); // only after it worked: a failed event comes again
res.sendStatus(200);
} catch (err) {
console.error("not handled, app2email will send it again:", event.id, err.message);
res.sendStatus(503);
}
});
app.listen(PORT, () => console.log(`handoff bot on http://localhost:${PORT}/webhook`));# Python 3.9 or newer. pip install flask requests then flask --app handoff run --port 3000
import hashlib, hmac, json, os, re, time
from urllib.parse import quote
import requests
from flask import Flask, request
NUMBER, API_KEY, SECRET = os.environ["NUMBER"], os.environ["API_KEY"], os.environ["WEBHOOK_SECRET"]
API = f"https://api.app2email.com/v1/{NUMBER}"
ASKS_FOR_PERSON = re.compile(r"\b(human|person|someone|staff|manager)\b", re.I)
done = set() # handled event ids: use a database table or Redis in production
def verify(raw: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
t = re.search(r"(?:^|,)\s*t=(\d+)", header or "")
v1 = re.findall(r"(?:^|,)\s*v1=([0-9a-f]+)", header or "") # two during a secret change
if not t or not v1 or abs(time.time() - int(t.group(1))) > tolerance:
return False
expected = hmac.new(secret.encode(), t.group(1).encode() + b"." + raw, hashlib.sha256).hexdigest()
return any(hmac.compare_digest(v, expected) for v in v1)
def api(method, path, body=None, idempotency_key=None):
headers = {"Authorization": f"Bearer {API_KEY}"}
if idempotency_key:
headers["Idempotency-Key"] = idempotency_key
for attempt in (1, 2, 3):
res = requests.request(method, API + path, json=body, headers=headers, timeout=4)
data = res.json()
if res.ok:
return data
code = data.get("error", {}).get("code")
wait = int(res.headers.get("Retry-After", "1"))
if code == "rate_limited" and attempt < 3 and wait <= 3:
time.sleep(wait)
continue
if res.status_code >= 500 or res.status_code == 429:
raise RuntimeError(f"{code} {data.get('request_id')}")
print("not done:", method, path, code, data.get("error", {}).get("how_to_fix"), data.get("request_id"))
return data
def later(what, *args, **kwargs):
try:
api(*args, **kwargs)
except Exception as err: # best effort: logged, never retried
print(what, "failed:", err)
def wants_person(m):
return ((m.get("interactive") or {}).get("id") == "person"
or (m.get("button") or {}).get("payload") == "person"
or (m.get("type") == "text" and ASKS_FOR_PERSON.search(m.get("text") or "")))
def hand_over(m, conv):
to = m.get("from") or m.get("from_user_id")
contact = quote(to, safe="")
reason = "customer asked for a person"
summary = f'{conv.get("name") or "The customer"} wrote: "{(m.get("text") or "")[:300]}"'
# 1. The owner first: from now on no automatic answer reaches this contact. A failure here is retried.
api("PUT", f"/conversations/{contact}/owner",
{"owner": "human", "reason": reason, "summary": summary, "until_minutes": 480})
# 2. The rest is best effort, so nothing is done twice.
if conv.get("window_open"):
later("message", "POST", "/messages", {"to": to, "type": "text",
"text": {"body": "Thanks! A person from our team will answer you here soon."}},
idempotency_key=f"handoff-{m['message_id']}")
later("assign", "PUT", f"/conversations/{contact}/assignee", {"assignee": "auto"})
later("note", "POST", f"/conversations/{contact}/notes", {"text": f"Bot handover: {reason}. {summary}"})
def on_message(m):
contact = quote(m.get("from") or m.get("from_user_id"), safe="")
conv = api("GET", f"/conversations/{contact}")
if conv.get("owner") and conv.get("owner") != "agent":
return # a person has it, or it is paused: stay quiet
if wants_person(m):
return hand_over(m, conv)
# ... your bot's normal answer goes here (see the chatbot guide)
def on_solved(d):
contact = quote(d["contact"], safe="")
conv = api("GET", f"/conversations/{contact}")
if conv.get("owner") == "human":
api("PUT", f"/conversations/{contact}/owner", {"owner": "", "reason": "solved by the team"})
app = Flask(__name__)
@app.post("/webhook")
def webhook():
raw = request.get_data()
if not verify(raw, request.headers.get("X-App2email-Signature"), SECRET):
return "bad signature", 401
event = json.loads(raw)
if event.get("test") or event["id"] in done:
return "", 200
d = event.get("data", {})
try:
if event["type"] == "message.received":
on_message(d)
elif event["type"] == "conversation.status_changed" and d.get("status") == "solved":
on_solved(d)
elif event["type"] == "conversation.owner_changed":
print(f'{d["contact"]}: {d.get("previous_owner") or "normal"} -> {d.get("owner") or "normal"} ({d.get("set_by")})')
elif event["type"] == "ai.handover":
print(f'AI handed {d["contact"]} to the team: {d.get("reason")}')
except Exception as err:
print("not handled, app2email will send it again:", event["id"], err)
return "", 503
done.add(event["id"]) # only after it worked: a failed event comes again
return "", 200यह ऐसे क्यों बना है:
owner human मिलेगा और जांच पर रुक जाएगा, इसलिए ये चरण वैसे भी दो बार नहीं चलेंगे।"assignee": "auto" नंबर का ऑटो-असाइन नियम इस्तेमाल करता है। प्लान में टीम inbox के बिना यह 403 team_inbox_not_in_plan देता है, जो लॉग होता है; हैंडओवर खुद फिर भी काम करता है।human वाले owner को छूता है। जो चैट paused है, वह paused ही रहती है।WhatsApp पर ग्राहक को अपना मैसेज दिखता है, फिर "Thanks! A person from our team will answer you here soon.", फिर आपकी टीम के किसी व्यक्ति का जवाब। Inbox में चैट Ben को असाइन है, और हैंडओवर के ऊपर पीला नोट है।
आपके webhook को ये इवेंट मिलते हैं, हर एक सामान्य envelope (id, type, created, number, data) में, और type हेडर X-App2email-Event में भी होता है:
| इवेंट | कब |
|---|---|
conversation.owner_changed | owner बदला: human, agent, paused या सामान्य पर वापस; या WhatsApp के AI एजेंट ने बातचीत ली या आगे दी (owner whatsapp_ai) |
conversation.assigned | चैट टीम के किसी व्यक्ति को दी गई, या किसी को नहीं: Inbox में, ऑटो-असाइन नियम से, किसी ऑटोमेशन से, AI जवाब से या API से |
conversation.note_added | एक आंतरिक नोट जोड़ा गया (संपर्क को कभी नहीं भेजा जाता) |
conversation.status_changed | चैट सुलझी हुई चिह्नित हुई, या फिर खुली (किसी व्यक्ति, API, या संपर्क के नए मैसेज से) |
ai.handover | AI जवाबों ने चैट किसी व्यक्ति को सौंपी: हैंडओवर मैसेज भेजा गया और owner human हो गया |
message.status | "कोई व्यक्ति जवाब देगा" वाला मैसेज भेजा गया, डिलीवर हुआ और पढ़ा गया |
किसी व्यक्ति ने कमान संभाली (conversation.owner_changed):
{
"id": "evt_Xq3k9m2Lw8Rt5Yp1Zs01",
"type": "conversation.owner_changed",
"created": "2026-11-21T01:21:00.000Z",
"number": "4976659348270",
"data": {
"contact": "61412345678",
"owner": "human",
"reason": "customer asked for a person",
"summary": "John wrote: \"Can I talk to a person about my delivery?\"",
"until": "2026-11-21T09:21:00.000Z",
"set_by": "api",
"timestamp": "2026-11-21T01:21:00.000Z"
}
}बॉट के पास वापस (वही इवेंट, owner खाली):
{
"id": "evt_Xq3k9m2Lw8Rt5Yp1Zs07",
"type": "conversation.owner_changed",
"created": "2026-11-21T02:15:01.000Z",
"number": "4976659348270",
"data": {
"contact": "61412345678",
"owner": "",
"previous_owner": "human",
"reason": "solved by the team",
"set_by": "api",
"timestamp": "2026-11-21T02:15:01.000Z"
}
}असाइन हुई (conversation.assigned):
{
"id": "evt_Team3k9m2Lw8Rt5Yp1Z01",
"type": "conversation.assigned",
"created": "2026-11-21T01:21:01.000Z",
"number": "4976659348270",
"data": {
"contact": "61412345678",
"conversation_id": 1234,
"assignee": "k3x9q2m7p4z8w1v",
"assignee_name": "Ben",
"previous_assignee": null,
"by": "auto",
"timestamp": "2026-11-21T01:21:01.000Z"
}
}सुलझी (conversation.status_changed):
{
"id": "evt_Team3k9m2Lw8Rt5Yp1Z02",
"type": "conversation.status_changed",
"created": "2026-11-21T02:15:00.000Z",
"number": "4976659348270",
"data": {
"contact": "61412345678",
"conversation_id": 1234,
"status": "solved",
"previous_status": "open",
"by": "dashboard:ben@example.com",
"timestamp": "2026-11-21T02:15:00.000Z"
}
}by और set_by बताते हैं कि बदलाव किसने किया: dashboard:<email>, api:<key name> या api, automation: <rule>, ai, auto (ऑटो-असाइन नियम), या contact (नए मैसेज ने चैट फिर खोली)।
रेफ़रेंस यह नहीं कहता कि until_minutes खत्म होने पर कोई इवेंट भेजा जाता है। उसके लिए किसी इवेंट पर भरोसा न करें: हर जवाब से पहले GET /conversations/{contact} से owner पढ़ें, जैसा ऊपर का कोड करता है।
अगर नंबर आपके अपने बॉट के बजाय AI जवाब (app2email का असिस्टेंट, Professional प्लान और ट्रायल पर) इस्तेमाल करता है, तो हैंडओवर पहले से बना हुआ है। असिस्टेंट चैट किसी व्यक्ति को तब सौंपता है जब उसकी जानकारी सवाल को कवर नहीं करती, ग्राहक किसी व्यक्ति को मांगता है, या अनुरोध को टीम की ज़रूरत होती है। वह हैंडओवर मैसेज भेजता है, owner को human सेट करता है, और ai.handover भेजता है:
{
"id": "evt_Ai3k9m2Lw8Rt5Yp1Zs002",
"type": "ai.handover",
"created": "2026-11-21T01:00:00.000Z",
"number": "4976659348270",
"data": {
"contact": "61412345678",
"conversation_id": 1234,
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTgA",
"text": "Thanks, a person from our team will reply soon.",
"reason": "the customer asks for a refund",
"model": "claude-haiku-5-5",
"owner": "human",
"timestamp": "2026-11-21T01:00:00.000Z"
}
}जब हैंडओवर मैसेज भेजा नहीं जा सका, तब message_id null होता है। ग्राहक को मिलने वाला टेक्स्ट GET /ai-answers/settings में handover_text है (खाली का मतलब डिफ़ॉल्ट; handover_text_sent दिखाता है कि क्या भेजा जाता है)। इसे PUT /ai-answers/settings से बदला जाता है (scope settings:manage, sandbox key से नहीं)।
चैट ऑटोमेशन नियम भी चैट सौंप सकते हैं: "hand to a person" उनके चरणों में से एक है, असाइन करने, सुलझा हुआ चिह्नित करने और नोट जोड़ने के साथ।
MCP सर्वर https://api.app2email.com/mcp/conversations में इस गाइड के कॉल टूल के रूप में हैं, उसी Authorization: Bearer key के साथ: get_conversation, get_conversation_messages, set_conversation_owner, list_team_members, assign_conversation, set_conversation_status, add_conversation_note, list_conversation_notes। पूरे सर्वर https://api.app2email.com/mcp में भी ये हैं। देखें MCP से AI एजेंट को अपना WhatsApp चलाने दें और MCP।
एजेंटों का नियम आपके बॉट जैसा ही है: जब संपर्क किसी व्यक्ति को मांगे या एजेंट मदद न कर सके, तो छोटे reason और एक summary के साथ human सेट करें, और जो चैट किसी व्यक्ति ने ली है उसे वापस (agent या "") न लें, जब तक उपयोगकर्ता ने न कहा हो।
हर इवेंट सत्यापित करें। हेडर X-App2email-Signature है t=<unix seconds>,v1=<hex>: t, एक बिंदु और raw body का HMAC-SHA256, webhook के signing secret (whsec_..., prefix सहित) को key बनाकर। हर v1= जांचें (secret बदलने के बाद पुराना secret रखा जाए तो दो होते हैं), constant time में तुलना करें, और पुराने t को अस्वीकार करें (ऊपर का कोड 5 मिनट की छूट देता है)। X-Hub-Signature-256 (sha256= और raw body का HMAC-SHA256, जैसे Meta हस्ताक्षर करता है) भी मौजूद है, केवल मौजूदा secret के साथ। अधिक: Webhooks।
जल्दी जवाब दें और दोहराव हटाएं। 10 सेकंड के भीतर 2xx लौटाएं; रीडायरेक्ट फ़ॉलो नहीं किए जाते। विफल इवेंट 10 s, 1 min, 5 min, 30 min, 1, 2, 4, 8 और 16 घंटे बाद फिर भेजा जाता है। इवेंट id (X-App2email-Delivery में भी) हर बार वही रहता है: संभाले हुए ids को कम से कम दो दिन रखें, मेमोरी के बजाय database या Redis में।
हर जवाब से पहले owner जांचें। जवाब केवल तब दें जब owner "" हो (या आपका अपना agent निशान)। इवेंट देर से या क्रम से बाहर आ सकते हैं, इसलिए आखिरी देखे conversation.owner_changed पर भरोसा करने के बजाय बातचीत पढ़ें, और इवेंट को data.timestamp से क्रमबद्ध करें।
एक बार सौंपें। पहले owner सेट करें; उसे दोहराना सुरक्षित है। "कोई व्यक्ति जवाब देगा" मैसेज को ग्राहक के message_id से बनी Idempotency-Key के साथ भेजें (24 घंटे के भीतर वही key दोबारा नहीं भेजी जाती; जवाब Idempotent-Replayed: true के साथ लौटता है)। नोट और "assignee": "auto" idempotent नहीं हैं: उन्हें एक बार चलाएं।
रेट लिमिट का सम्मान करें। हर जवाब में X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (फिर से पूरा होने तक के सेकंड) और X-RateLimit-Policy होते हैं। सीमा पार होने पर: Retry-After हेडर और error.retry_after_seconds के साथ 429 rate_limited; उतनी देर रुकें, फिर दोबारा कोशिश करें। अधिक: Limits।
24 घंटे की विंडो का ध्यान रखें। आपके बॉट का "कोई व्यक्ति जवाब देगा" मैसेज और आपकी टीम के जवाब free-form मैसेज हैं: वे ग्राहक के आखिरी मैसेज के 24 घंटे के भीतर ही काम करते हैं (app2email 15 मिनट पहले रुक जाता है; window_closes_at ठीक समय है)। उसके बाद केवल मंज़ूर टेम्पलेट। अगर कोई व्यक्ति चैट देर से उठाता है, तो पहले window_open जांचें।
opt-out का सम्मान करें। Do Not Call सूची free-form जवाबों पर लागू नहीं होती, क्योंकि ग्राहक ने आपको लिखा है। अपवाद: जब उनका आखिरी मैसेज खुद opt-out था, तब जवाब पर 403 recipient_opted_out आता है जब तक वे फिर न लिखें। ऐसा होने पर contact.opted_out आपको बताता है।
हर नंबर पर एक ही जवाब देने वाला। ऑटो रिप्लाई, चैट ऑटोमेशन, AI जवाब और आपका बॉट सब एक जैसे मैसेज देखते हैं। तय करें कि कौन जवाब देगा। agent का owner AI जवाबों को दूर रखता है, जब तक आपका बॉट संपर्क को संभाल रहा है।
सारांश लोगों के लिए लिखें। summary उन लोगों तक पहुंचता है जो WhatsApp मैसेज ईमेल से पढ़ते हैं, और नोट Inbox में पढ़ा जाता है। उन्हें छोटा और उपयोगी रखें: ऑर्डर नंबर, ग्राहक क्या चाहता है, बॉट ने क्या पहले ही आज़माया। उनमें कभी गोपनीय जानकारी या भुगतान विवरण न डालें।
न्यूनतम पहुंच। हैंडओवर को messages:send और messages:read चाहिए। key को अपने सर्वर पर रखें, कभी वेब पेज या लॉग में नहीं। key को आपके सर्वर के IP पतों तक सीमित किया जा सकता है, उस पर दैनिक सीमा लगाई जा सकती है, या वह समाप्त हो सकती है।
| आपको क्या दिखता है | कारण | समाधान |
|---|---|---|
400 invalid_owner | owner "", agent, human या paused नहीं है | जैसे {"owner": "human", "reason": "customer asked for a person"} भेजें; बाकी फ़ील्ड वैकल्पिक हैं |
400 invalid_json | body वैध JSON नहीं है | कोटेशन, कॉमा और ब्रैकेट जांचें |
400 invalid_phone | URL में संपर्क न नंबर है न business-scoped user id | पूरा नंबर इस्तेमाल करें, पहले देश कोड, या from_user_id |
404 conversation_not_found | इस संपर्क के साथ अभी कोई बातचीत नहीं | business-scoped user id वाली बातचीत तब शुरू होती है जब संपर्क नंबर पर लिखता है |
400 invalid_assignee | assignee न user id है, न ईमेल, न auto और न "" | GET /team/members से user_id या email लें |
422 not_a_member | वह व्यक्ति नंबर का owner नहीं है, न ही जवाब दे सकने वाला सदस्य (viewers को असाइन नहीं किया जा सकता) | GET /team/members बताता है कि किसे असाइन किया जा सकता है |
400 invalid_conversation_status | status open या solved नहीं है | {"status": "solved"} या {"status": "open"} भेजें |
400 invalid_conversation_note | नोट खाली है या 4000 अक्षर से लंबा है | 1 से 4000 अक्षर के साथ {"text": "..."} भेजें |
403 team_inbox_not_in_plan | असाइनमेंट, नोट और खुला / सुलझा नंबर के प्लान में नहीं हैं | ये Trial और Professional प्लान के साथ आते हैं; owner इनके बिना काम करता है |
503 team_database_pending | टीम inbox app2email की ओर से database अपडेट का इंतज़ार कर रहा है | बाद में फिर कोशिश करें; बाकी सब पहले जैसा चलता है |
403 insufficient_scope | key में एक अनुमति नहीं है (details.required_scope) | messages:send और messages:read वाली key इस्तेमाल करें |
403 not_in_instant_sandbox | डेमो नंबर में यह कॉल नहीं है (जैसे टीम वाले कॉल) | अपने नंबर पर sandbox key, या सामान्य key इस्तेमाल करें |
403 plan_not_allowed, service_not_live | कोई सशुल्क प्लान नहीं, या सेवा चालू नहीं | प्लान चुनें; रुकी हुई सेवा Settings पेज पर "Go Live" से चालू होती है |
422 outside_24h_window | ग्राहक ने आखिरी बार 24 घंटे से ज़्यादा पहले लिखा था | इसके बजाय मंज़ूर टेम्पलेट भेजें |
403 recipient_opted_out | ग्राहक का आखिरी मैसेज opt-out था | जब तक वे फिर न लिखें, जवाब न दें |
429 rate_limited | इस key के लिए बहुत ज़्यादा कॉल | Retry-After सेकंड रुकें, फिर दोबारा कोशिश करें |
| हैंडओवर के बाद भी बॉट जवाब देता है | आपका बॉट owner नहीं जांचता, या नंबर पर कोई और जवाब देने वाला चल रहा है | हर जवाब से पहले GET /conversations/{contact} पढ़ें; डैशबोर्ड पर ऑटो रिप्लाई, ऑटोमेशन और AI जवाब जांचें |
| A2A / OpenClaw एजेंट अब भी जवाब देता है | नंबर की सेटिंग a2a.respect_owner बंद है | GET /settings/number इसे दिखाता है; यह डिफ़ॉल्ट रूप से चालू है |
हर जवाब में एक request_id होता है। GET /requests/{request_id} दिखाता है कि उसके लिए क्या लॉग हुआ (त्रुटियां और बदलाव करने वाली रिक्वेस्ट, 30 दिन रखी जाती हैं), और support@app2email.com भी उसे ढूंढ सकता है। सभी कोड: Errors।
app2email के स्वचालित जवाबों के लिए कोई नहीं: दोनों में ऑटो रिप्लाई, A2A / OpenClaw एजेंट और AI जवाब संपर्क को छोड़ देते हैं। जब चैट किसी व्यक्ति के पास हो तब human इस्तेमाल करें, और paused तब जब आप बस इस संपर्क के लिए स्वचालित जवाब कुछ समय रोकना चाहें, जैसे कुछ जांचते समय। दोनों until_minutes से अपने आप खत्म हो सकते हैं।
agent बताता है कि कोई ऑटोमेशन संपर्क का owner है। यह बाकी सबके लिए एक निशान है, और AI जवाबों को दूर रखता है (वे केवल बिना owner वाली बातचीत का जवाब देते हैं)। इसे तब सेट करें जब कई सिस्टम एक ही नंबर देखते हों और आप चाहते हों कि वे देखें कि आपका बॉट इस संपर्क के साथ किसी काम के बीच में है। बॉट का काम पूरा होने पर फिर "" सेट करें।
WhatsApp का अपना AI एजेंट बातचीत को थामे हुए है। conversation.owner_changed बताता है कि वह चैट कब लेता है या आगे देता है (set_by whatsapp, handover control_taken या control_passed के साथ)। जब तक वह चैट थामे है, जवाब तभी जाता है जब वह बातचीत आगे दे दे।
हां, फ़ोन नंबर के लिए: जिस नंबर से कभी संपर्क नहीं हुआ उसका बातचीत रिकॉर्ड बन जाता है, इसलिए owner पहले सेट किया जा सकता है। business-scoped user id के लिए संपर्क को पहले लिखना होगा (वरना 404 conversation_not_found)।
हां। तुरंत मिलने वाला sandbox (POST https://api.app2email.com/v1/account/sandbox, बिना key, बिना body) डेमो नंबर 12025550100 के लिए एक key (a2es_..., 7 दिन वैध) देता है। इसका नकली ग्राहक 12025550105 किसी व्यक्ति को मांगता है। इवेंट GET /events?wait=25 से पढ़ें और owner PUT /conversations/{contact}/owner से सेट करें; टीम वाले कॉल वहां नहीं हैं। WhatsApp तक कुछ नहीं पहुंचता।
हां: GET /events?wait=25 (scope messages:read) वही इवेंट लौटाता है जो webhook को मिलते हैं, उसी id के साथ। जवाब का cursor रखें और अगली कॉल पर उसे after के रूप में दें। API से WhatsApp चैटबॉट बनाएं में यह लूप दिखाया गया है।
GET /conversations/{contact}/notes?include_activity=true (scope messages:read) नोट की सूची देता है, सबसे पुराना पहले, और include_activity=true जोड़ने पर गतिविधि पंक्तियां भी (assigned, unassigned, solved, reopened)। GET /conversations/{phone}/messages दोनों दिशाओं के मैसेज की सूची देता है।
हस्ताक्षरित webhook पर मैसेज पाएं और अपने ही कोड से उनका जवाब दें।
पुष्टि और रिमाइंडर के लिए मंज़ूर utility टेम्पलेट, डिलीवरी स्टेटस के साथ।
एक टेम्पलेट सूची या सेगमेंट को, सहमति रिकॉर्ड और Do Not Call सूची के साथ।
Claude या किसी दूसरे एजेंट को सीमित scope वाली key और अनुमोदन के साथ अपने नंबर से जोड़ें।
चैट में पेमेंट लिंक भेजें और भुगतान होने पर जानें।