बिना अकाउंट के, तुरंत मिलने वाली sandbox key से app2email WhatsApp API आज़माएं, फिर अपना नंबर कनेक्ट करें, अपना पहला टेम्पलेट भेजें, उसका स्टेटस देखें और जवाब पढ़ें।
यह गाइड आपको दो हिस्सों में, शुरुआत से एक WhatsApp मैसेज और उसके जवाब तक ले जाती है।
भाग 1, तुरंत मिलने वाला sandbox (लगभग 2 मिनट, अकाउंट की ज़रूरत नहीं): आपको एक डेमो नंबर की key मिलती है, आप एक नकली ग्राहक को टेम्पलेट भेजते हैं, उसे sent से read तक जाते देखते हैं और ग्राहक का जवाब पढ़ते हैं। कुछ भी WhatsApp तक नहीं पहुंचता, लेकिन हर रिक्वेस्ट और जवाब का रूप असली API जैसा ही है, इसलिए यही कोड बाद में भी चलेगा।
भाग 2, आपका अपना नंबर: आप साइन अप करते हैं, अपना WhatsApp नंबर कनेक्ट करते हैं, एक API key बनाते हैं और उसी तरह का मैसेज किसी असली फ़ोन पर भेजते हैं।
ग्राहक को क्या दिखता है (भाग 2): आपके बिज़नेस के नाम से एक WhatsApp मैसेज, जैसे "नमस्ते Ava, आपका ऑर्डर #1234 भेज दिया गया है।" जब वे जवाब देते हैं, तो आप अगले 24 घंटे तक सामान्य टेक्स्ट से उत्तर दे सकते हैं।
आपको क्या दिखता है: भेजने का जवाब, जिसमें message_id होता है, उस मैसेज का स्टेटस (sent, delivered, read), ग्राहक का जवाब message.received इवेंट के रूप में, और हर मैसेज app2email के Activity Log और Inbox में।
curl वाला टर्मिनल, या Node.js 18+, या requests के साथ Python 3.9+। इसके अलावा कुछ नहीं।| Scope | इस गाइड में यह किसलिए है |
|---|---|
messages:send | टेम्पलेट और जवाब भेजना (POST /messages) |
messages:read | अपने टेम्पलेट की सूची देखना (GET /templates), किसी मैसेज का स्टेटस पढ़ना (GET /messages/{message_id}) और इवेंट लाना (GET /events) |
webhooks:manage | केवल तब, जब आप इवेंट अपने सर्वर पर पुश करवाना चाहते हों (POST /webhooks) |
GET /me किसी भी वैध key के साथ काम करता है, उसके scopes जो भी हों।
तुरंत मिलने वाला sandbox एक डेमो WhatsApp नंबर, 12025550100, है, जिसमें पांच नकली ग्राहक हैं जो असली ग्राहकों की तरह प्रतिक्रिया देते हैं। शुरू करने के लिए आपको न अकाउंट चाहिए, न key।
इसमें आपको क्या मिलता है:
POST https://api.app2email.com/v1/account/sandbox, बिना key और बिना body के, एक तुरंत मिलने वाली sandbox key (a2es_...) लौटाता है। यह सिर्फ़ एक बार दिखती है और 7 दिन तक वैध रहती है। यह केवल डेमो नंबर पर काम करती है।sandbox_recipient का जवाब आता है।hello_world (en_US, UTILITY), order_update (en, UTILITY) और weekend_offer (en, MARKETING)। इनकी जांच उसी कोड से होती है जिससे असली टेम्पलेट की होती है।GET /me, GET /templates, POST /messages, GET /messages, GET /conversations, GET /conversations/{contact}, PUT /conversations/{contact}/owner, GET /events और POST /sandbox/inbound (किसी नकली ग्राहक से आपको मैसेज लिखवाता है)। कोई भी दूसरी कॉल 403 not_in_instant_sandbox लौटाती है।GET /events से आते हैं।curl -X POST https://api.app2email.com/v1/account/sandboxconst res = await fetch("https://api.app2email.com/v1/account/sandbox", { method: "POST" });
const { instant_sandbox } = await res.json();
console.log(instant_sandbox.api_key, instant_sandbox.expires);import requests
res = requests.post("https://api.app2email.com/v1/account/sandbox", timeout=10)
sandbox = res.json()["instant_sandbox"]
print(sandbox["api_key"], sandbox["expires"])जवाब में आपको क्या मिलता है (छोटा किया गया: जवाब में उपलब्ध कॉल और शुरू में करने लायक कॉल भी सूचीबद्ध होती हैं, calls और try_first में):
{
"success": true,
"request_id": "s4ndb",
"instant_sandbox": {
"api_key": "a2es_000qlA9iTHS1NETB9JExample...",
"expires": "2026-11-22T03:00:00.000Z",
"number": "12025550100",
"base_url": "https://api.app2email.com/v1/12025550100",
"mcp_url": "https://api.app2email.com/mcp",
"authorization": "Authorization: Bearer <api_key>",
"test_contacts": [
{ "number": "12025550101", "name": "Ava", "behaviour": "answers every message a few seconds later" },
{ "number": "12025550102", "name": "Ben", "behaviour": "reads, never answers: a free-form message to him is 422 outside_24h_window" },
{ "number": "12025550103", "name": "Cara", "behaviour": "delivery fails: message.status failed and message.failed" },
{ "number": "12025550104", "name": "Dan", "behaviour": "answers STOP: contact.opted_out, then a marketing template to him is 403 recipient_opted_out" },
{ "number": "12025550105", "name": "Eve", "behaviour": "asks for a person: set the conversation's owner to human" }
],
"templates": ["hello_world (en_US, UTILITY)", "order_update (en, UTILITY)", "weekend_offer (en, MARKETING)"],
"not_here": "Webhooks (use GET /events), media uploads, contacts, broadcasts in the background, scheduled sends and every other call need a connected number: they answer 403 not_in_instant_sandbox here."
},
"next": "For a real WhatsApp number call create_account with the person's e-mail address: they confirm, connect their number and choose a plan.",
"documentation_url": "https://www.app2email.com/docs/api/sandbox"
}api_key संभालकर रखें: यह दोबारा नहीं दिखाई जाती। खो जाए तो नई ले लें। नीचे SANDBOX_KEY का मतलब यही key है। यह काम कर रही है या नहीं, इसकी जल्दी जांच: Authorization: Bearer SANDBOX_KEY के साथ GET https://api.app2email.com/v1/12025550100/me।
GET /templates हर टेम्पलेट की सूची देता है, साथ में यह भी कि उसे कौन-से मान चाहिए और एक पूरा example_request, जिसे मान बदलकर आप भेज सकते हैं।
curl https://api.app2email.com/v1/12025550100/templates \
-H "Authorization: Bearer SANDBOX_KEY"const KEY = process.env.SANDBOX_KEY;
const API = "https://api.app2email.com/v1/12025550100";
const res = await fetch(`${API}/templates`, { headers: { Authorization: `Bearer ${KEY}` } });
const { templates } = await res.json();
for (const t of templates) console.log(t.name, t.language, t.status, t.needs);import os, requests
KEY = os.environ["SANDBOX_KEY"]
API = "https://api.app2email.com/v1/12025550100"
res = requests.get(f"{API}/templates", headers={"Authorization": f"Bearer {KEY}"}, timeout=10)
for t in res.json()["templates"]:
print(t["name"], t["language"], t["status"], t.get("needs"))हर एंट्री में name, language, category, status, can_send, needs और, मंज़ूर किए गए टेम्पलेट के लिए, example_request होता है। order_update को अपनी body में दो टेक्स्ट मान चाहिए: ग्राहक का नाम और एक ऑर्डर नंबर।
Ava (12025550101) हर मैसेज का जवाब कुछ सेकंड बाद देती है। टेम्पलेट वह मैसेज है जिसे आप किसी भी समय भेज सकते हैं, उसे भी जिसने अभी तक आपको नहीं लिखा।
curl -X POST https://api.app2email.com/v1/12025550100/messages \
-H "Authorization: Bearer SANDBOX_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "12025550101",
"type": "template",
"template": {
"name": "order_update",
"language": { "code": "en" },
"components": [
{ "type": "body", "parameters": [
{ "type": "text", "text": "Ava" },
{ "type": "text", "text": "#1234" }
] }
]
}
}'const res = await fetch(`${API}/messages`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
to: "12025550101",
type: "template",
template: {
name: "order_update",
language: { code: "en" },
components: [
{ type: "body", parameters: [{ type: "text", text: "Ava" }, { type: "text", text: "#1234" }] },
],
},
}),
});
const sent = await res.json();
console.log(res.status, sent.message_id, sent.status);res = requests.post(
f"{API}/messages",
headers={"Authorization": f"Bearer {KEY}"},
json={
"to": "12025550101",
"type": "template",
"template": {
"name": "order_update",
"language": {"code": "en"},
"components": [
{"type": "body", "parameters": [{"type": "text", "text": "Ava"}, {"type": "text", "text": "#1234"}]}
],
},
},
timeout=10,
)
sent = res.json()
print(res.status_code, sent.get("message_id"), sent.get("status"))जवाब में आपको क्या मिलता है (HTTP 200, छोटा किया गया): मैसेज स्वीकार कर लिया गया। text वह मैसेज है जैसा ग्राहक उसे देखता है।
{
"success": true,
"request_id": "kxrkf",
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
"status": "accepted",
"from": "12025550100",
"to": "12025550101",
"template": { "name": "order_update", "language": "en", "category": "UTILITY" },
"text": "Hi Ava, your order #1234 has shipped."
}गलत मान एक त्रुटि के रूप में लौटता है, जिसमें स्थिर error.code, एक how_to_fix और, टेम्पलेट की गलतियों के लिए, पूरा सही example_request होता है। आज़माकर देखें: एक पैरामीटर छोड़ दें और आपको 422 template_parameters_invalid मिलेगा।
GET /events?wait=25 अगले इवेंट के लिए 25 सेकंड तक इंतज़ार करता है, इसलिए आपको किसी सार्वजनिक पते की ज़रूरत नहीं। आपको sent, delivered और read के साथ message.status मिलता है, फिर Ava के जवाब के साथ message.received।
curl "https://api.app2email.com/v1/12025550100/events?wait=25" \
-H "Authorization: Bearer SANDBOX_KEY"let after = "";
for (let i = 0; i < 5; i++) {
const q = after ? `&after=${encodeURIComponent(after)}` : "";
const res = await fetch(`${API}/events?wait=25${q}`, { headers: { Authorization: `Bearer ${KEY}` } });
const page = await res.json();
for (const e of page.events ?? []) console.log(e.type, e.data.status ?? e.data.text);
after = page.cursor ?? after;
}after = ""
for _ in range(5):
params = {"wait": 25, **({"after": after} if after else {})}
page = requests.get(f"{API}/events", params=params,
headers={"Authorization": f"Bearer {KEY}"}, timeout=40).json()
for e in page.get("events", []):
print(e["type"], e["data"].get("status") or e["data"].get("text"))
after = page.get("cursor", after)जवाब में आपको क्या मिलता है (छोटा किया गया; Ava के शब्द बदलते रहते हैं):
{
"success": true,
"request_id": "e7fd2",
"events": [
{
"id": "evt_Xq3k9m2Lw8Rt5Yp1Zs01",
"type": "message.status",
"created": "2026-11-15T03:10:02.000Z",
"number": "12025550100",
"data": {
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
"to": "12025550101",
"status": "delivered",
"timestamp": "2026-11-15T03:10:01.000Z",
"sent_by": "api"
}
},
{
"id": "evt_Ab7c2d9Ef4Gh6Jk8Lm03",
"type": "message.received",
"created": "2026-11-15T03:10:09.000Z",
"number": "12025550100",
"data": {
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgASGBQzQUZCMTY0MDc2MUYwNzBDNTY5MAA=",
"from": "12025550101",
"name": "Ava",
"type": "text",
"text": "Thanks! When will it arrive?",
"timestamp": "2026-11-15T03:10:08.000Z"
}
}
],
"count": 2,
"cursor": "ec_184467",
"has_more": false
}अगली कॉल में cursor को after के रूप में दें, ताकि सिर्फ़ नए इवेंट मिलें। हर इवेंट वही JSON है जो बाद में webhook को मिलता है, उसी id के साथ। types=message.received केवल आने वाले मैसेज देता है। GET /messages भी मैसेज की सूची देता है, हर भेजे गए मैसेज के status और times के साथ।
Ava ने अभी लिखा है, इसलिए उसकी 24 घंटे की विंडो खुली है और आप सादा टेक्स्ट भेज सकते हैं:
curl -X POST https://api.app2email.com/v1/12025550100/messages \
-H "Authorization: Bearer SANDBOX_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "12025550101", "type": "text", "text": {"body": "It arrives on Friday."}}'यही टेक्स्ट Ben (12025550102) को, जिसने कभी नहीं लिखा, भेजने पर 422 outside_24h_window आता है: विंडो के बाहर केवल टेम्पलेट भेजा जा सकता है।
| ग्राहक | उन्हें क्या भेजें | आप क्या सीखते हैं |
|---|---|---|
Ben, 12025550102 | एक टेक्स्ट | वह पढ़ता है पर कभी जवाब नहीं देता: सादे टेक्स्ट पर 422 outside_24h_window |
Cara, 12025550103 | hello_world | डिलीवरी विफल होती है: failed के साथ message.status, और message.failed |
Dan, 12025550104 | order_update, फिर weekend_offer | वह STOP लिखता है: contact.opted_out, फिर मार्केटिंग टेम्पलेट पर 403 recipient_opted_out |
Eve, 12025550105 | कोई भी टेम्पलेट | वह किसी व्यक्ति को बुलाने को कहती है: PUT /conversations/{contact}/owner और "owner": "human" से चैट सौंप दें |
टर्मिनल की जगह AI असिस्टेंट से: Management MCP सर्वर https://api.app2email.com/mcp/manage में टूल create_sandbox है, और तुरंत मिलने वाली key MCP सर्वर https://api.app2email.com/mcp पर भी काम करती है (check_key, list_templates, send_template, list_events, wait_for_message ...)। देखें MCP से AI एजेंट को अपना WhatsApp चलाने दें और Sandbox।
मैसेज असल में जाएंगे या नहीं, यह Meta की तरफ़ से तय होता है: अपने WhatsApp Business Account में भुगतान का तरीका जोड़ें, अपने बिज़नेस को सत्यापित करें और अपना डिस्प्ले नाम मंज़ूर करवाएं। शुरू करना इसमें आपका मार्गदर्शन करता है।
API key पेज पर messages:send और messages:read वाली एक key बनाएं (webhook चाहिए तो webhooks:manage भी जोड़ें)। key (a2en_...) सिर्फ़ एक बार दिखती है: इसे अपने सर्वर पर रखें, कभी किसी वेब पेज या लॉग में नहीं।
पहले अपने ही नंबर पर टेस्ट करने के लिए बनाते समय Sandbox key पर टिक करें: हर जांच आपके अकाउंट पर चलती है, कुछ भी WhatsApp तक नहीं जाता, जवाबों में "sandbox": true होता है, मैसेज id wamid.SANDBOX. से शुरू होते हैं, और message.status इवेंट फिर भी आते हैं। जब असल में भेजने के लिए तैयार हों, तो बिना फ़्लैग वाली दूसरी key बनाएं।
हर रिक्वेस्ट में YOUR_NUMBER वह WhatsApp नंबर है जिससे आप भेजते हैं: पहले देश कोड, सिर्फ़ अंक।
curl https://api.app2email.com/v1/YOUR_NUMBER/me \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/me", {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
console.log(await res.json());import os, requests
res = requests.get("https://api.app2email.com/v1/YOUR_NUMBER/me",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}"}, timeout=10)
print(res.json())जवाब में आपको क्या मिलता है:
{
"success": true,
"request_id": "a7k3p",
"key_valid": true,
"api_version": "v1",
"number": "4976659348270",
"plan": "standard_5000",
"service_status": "LIVE",
"key": { "name": "First message", "scopes": ["messages:read", "messages:send"], "ip_allow": "" },
"limits": { "max_numbers_per_request": 1000, "requests_per_second": 20, "burst": 50, "rate_limit_mode": "enforce", "webhooks_max": 5 }
}service_status का LIVE होना ज़रूरी है, और key.scopes में वे scopes होने चाहिए जिनकी आपको ज़रूरत है (या पूरी पहुंच के लिए *)। sandbox key में "sandbox": true भी दिखता है।
GET /v1/YOUR_NUMBER/templates आपके टेम्पलेट की सूची देता है। "status": "APPROVED" और "can_send": true वाला एक चुनें और उसका example_request कॉपी करें। अभी कोई मंज़ूर टेम्पलेट नहीं है? डैशबोर्ड के Templates पेज पर एक बनाएं, या API से बनाने और उसे मंज़ूर करवाने के लिए ऑर्डर और अपॉइंटमेंट की सूचनाएं भेजें देखें।
टेम्पलेट अपने मोबाइल नंबर पर भेजें (बिज़नेस नंबर पर ही नहीं: उस पर 422 recipient_is_sender आता है)। एक 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: first-message-1" \
-d '{
"to": "61412345678",
"type": "template",
"template": {
"name": "order_update",
"language": { "code": "en" },
"components": [
{ "type": "body", "parameters": [
{ "type": "text", "text": "John" },
{ "type": "text", "text": "#1234" }
] }
]
}
}'const res = 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": "first-message-1",
},
body: JSON.stringify({
to: "61412345678",
type: "template",
template: {
name: "order_update",
language: { code: "en" },
components: [
{ type: "body", parameters: [{ type: "text", text: "John" }, { type: "text", text: "#1234" }] },
],
},
}),
});
const sent = await res.json();
console.log(res.status, sent.message_id ?? sent.error);res = requests.post(
"https://api.app2email.com/v1/YOUR_NUMBER/messages",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}", "Idempotency-Key": "first-message-1"},
json={
"to": "61412345678",
"type": "template",
"template": {
"name": "order_update",
"language": {"code": "en"},
"components": [
{"type": "body", "parameters": [{"type": "text", "text": "John"}, {"type": "text", "text": "#1234"}]}
],
},
},
timeout=10,
)
sent = res.json()
print(res.status_code, sent.get("message_id") or sent.get("error"))अपने टेम्पलेट का नाम, भाषा और मान इस्तेमाल करें (उसके example_request में ये होते हैं)। जवाब में आपको क्या मिलता है (HTTP 200):
{
"success": true,
"request_id": "kxrkf",
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
"status": "accepted",
"from": "4976659348270",
"to": "61412345678",
"template": { "name": "order_update", "language": "en", "category": "UTILITY" },
"text": "Hi John, your order #1234 has shipped.",
"conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_...",
"note": "accepted by WhatsApp. delivery and read status appear in your app2email Activity Log (WhatsApp sent).",
"contacts": [{ "input": "61412345678", "wa_id": "61412345678" }]
}बिना भेजे सब कुछ जांचने के लिए body में "dry_run": true जोड़ें (टेम्पलेट के मान, नंबर, Do Not Call सूची, मासिक सीमा)। जवाब में ठीक वही WhatsApp मैसेज दिखता है। कुछ भी भेजा, लॉग या गिना नहीं जाता।
GET /messages/{message_id} (scope messages:read) दिखाता है कि मैसेज कहां तक पहुंचा। id को URL-encode करें।
curl "https://api.app2email.com/v1/YOUR_NUMBER/messages/wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA%3D" \
-H "Authorization: Bearer YOUR_API_KEY"जवाब में आपको क्या मिलता है: status इनमें से एक होता है: accepted, sent, delivered, read, failed, deleted, queued या unknown। जो चरण अभी तक नहीं आए, वे times में नहीं होते, और reply तब दिखता है जब ग्राहक इस मैसेज का जवाब देता है।
{
"success": true,
"request_id": "p4n8w",
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
"to": "61412345678",
"status": "read",
"sent_by": "api",
"text": "Hi John, your order #1234 has shipped.",
"times": {
"submitted": "2026-11-06T01:00:00Z",
"accepted": "2026-11-06T01:00:01Z",
"sent": "2026-11-06T01:00:02Z",
"delivered": "2026-11-06T01:00:04Z",
"read": "2026-11-06T01:12:40Z"
},
"conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_..."
}अपने फ़ोन पर मैसेज का जवाब दें। जवाब को अपने कोड में पाने के दो तरीके हैं:
GET /v1/YOUR_NUMBER/events?wait=25&types=message.received, जैसा भाग 1 में है। आपके अपने नंबर पर पहली कॉल इवेंट फ़ीड को चालू कर देती है, और तब से इवेंट 72 घंटे तक रखे जाते हैं। इसलिए भेजने से पहले एक बार after=now के साथ कॉल करें और cursor संभालकर रखें।POST /v1/YOUR_NUMBER/webhooks और {"url": "https://your-server.example/webhook"} से एक बार webhook रजिस्टर करें (scope webhooks:manage), या उसे API key पेज पर Webhooks के अंतर्गत जोड़ें। फिर app2email हर इवेंट आपके URL पर एक हस्ताक्षरित POST के रूप में भेजता है। API से WhatsApp चैटबॉट बनाएं में हस्ताक्षर जांच के साथ पूरा रिसीवर है।जवाब message.received के रूप में आता है:
{
"id": "evt_Xq3k9m2Lw8Rt5Yp1Zs01",
"type": "message.received",
"created": "2026-11-06T01:00:00.000Z",
"number": "4976659348270",
"data": {
"message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
"from": "61412345678",
"name": "John",
"type": "text",
"text": "Thanks! When will it arrive?",
"conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_SAMPLEk3XbQ9rTzP2mW",
"timestamp": "2026-11-06T01:00:00.000Z"
}
}अब आप ग्राहक के आखिरी मैसेज के 24 घंटे बाद तक "type": "text" के साथ जवाब दे सकते हैं, ठीक भाग 1 की तरह।
message.status इवेंट मिलते हैं: sent, फिर delivered, फिर read जब आप उसे खोलते हैं। विफल मैसेज status: "failed" और एक error ऑब्जेक्ट के साथ message.status के रूप में आता है, और message.failed के रूप में भी।message.received के रूप में आता है, और सादे उत्तरों के लिए 24 घंटे की विंडो खुल जाती है।हर मैसेज एक ही बार भेजें। हर POST /messages को एक Idempotency-Key दें जो उस मैसेज के लिए अनोखी हो, जैसे आपका ऑर्डर नंबर और इवेंट। 24 घंटे के भीतर वही key वाली वही रिक्वेस्ट पहला जवाब दोबारा लाती है, हेडर Idempotent-Replayed: true के साथ। वही key, दूसरी body: 422 idempotency_key_reused।
इवेंट को उनके id से डुप्लिकेट होने से बचाएं। एक इवेंट दोबारा आ सकता है, जवाब खो जाने पर GET /events से और दोबारा कोशिश के बाद webhook से। जिन id को आप संभाल चुके हैं, उन्हें कम से कम दो दिन तक रखें।
webhook का हस्ताक्षर जांचें। हर webhook इवेंट में X-App2email-Signature: t=<unix seconds>,v1=<hex> होता है: यह t, एक बिंदु और कच्ची body का HMAC-SHA256 है, जिसमें webhook का secret (whsec_...) key है। जो इवेंट मेल न खाएं या जिनका t पुराना हो, उन्हें अस्वीकार करें।
रेट लिमिट का सम्मान करें। हर जवाब में X-RateLimit-Limit, X-RateLimit-Remaining और X-RateLimit-Reset होते हैं। सीमा पार करने पर आपको Retry-After के साथ 429 rate_limited मिलता है: उतनी देर रुकें, फिर दोबारा कोशिश करें। एक टेम्पलेट को कई नंबरों पर भेजने के लिए, हर एक के लिए अलग कॉल करने की जगह उन्हें एक ही कॉल में रखें।
24 घंटे की विंडो के बाहर टेम्पलेट। सादा टेक्स्ट केवल ग्राहक के आखिरी मैसेज के 24 घंटे के भीतर काम करता है (app2email 15 मिनट पहले रोक देता है)। बाकी हर चीज़ के लिए मंज़ूर किया हुआ टेम्पलेट चाहिए।
केवल उन्हीं को मैसेज करें जिन्होंने सहमति दी है। मार्केटिंग टेम्पलेट आपकी Do Not Call सूची के नंबरों पर नहीं भेजे जाते, और जो ग्राहक STOP लिखता है, वह उसमें जोड़ दिया जाता है (contact.opted_out)। सहमति के बारे में ऑप्ट-इन का सम्मान करने वाला मार्केटिंग ब्रॉडकास्ट भेजें में बताया गया है।
key को गोपनीय और छोटी रखें। key सर्वर पर रहे, कभी वेब पेज में नहीं। उसे केवल उतने scopes दें जितने की ज़रूरत है, और टेस्ट के लिए sandbox key इस्तेमाल करें।
| आप क्या देखते हैं | क्यों | समाधान |
|---|---|---|
POST /v1/account/sandbox से 429 | आपके पते से एक घंटे में 10 से ज़्यादा तुरंत मिलने वाली sandbox keys | Retry-After सेकंड रुकें, या जो key आपके पास है उसे इस्तेमाल करते रहें (7 दिन वैध) |
401 missing_api_key, invalid_api_key, api_key_expired, api_key_revoked | key नहीं है, गलत है, समाप्त हो चुकी है (तुरंत मिलने वाली sandbox key 7 दिन चलती है) या रद्द कर दी गई है | एक मौजूदा key के साथ Authorization: Bearer YOUR_API_KEY भेजें; नई तुरंत मिलने वाली key लें, या API key पेज से key लें |
403 api_key_number_mismatch | key URL वाले नंबर की नहीं, किसी दूसरे नंबर की है | URL में key का अपना नंबर डालें। तुरंत मिलने वाली sandbox key केवल 12025550100 पर काम करती है |
400 invalid_number_in_url | URL में नंबर देश कोड वाले अंक नहीं हैं | पूरा नंबर इस्तेमाल करें, सिर्फ़ अंक, + नहीं |
403 not_in_instant_sandbox | डेमो नंबर में यह कॉल नहीं है (जैसे webhooks) | वहां GET /events इस्तेमाल करें, या अपने नंबर पर sandbox key |
422 sandbox_recipient | तुरंत मिलने वाला sandbox केवल अपने नकली ग्राहकों को लिखता है | 12025550101 से 12025550105 पर भेजें |
403 plan_not_allowed, service_not_live | सशुल्क प्लान नहीं है, या सेवा रुकी हुई है | प्लान चुनें; रुकी हुई सेवा Settings पेज पर "Go Live" से चालू होती है |
403 insufficient_scope | key में कोई अनुमति नहीं है (details.required_scope) | messages:send और messages:read वाली key बनाएं |
403 sandbox_key | sandbox key यह नहीं कर सकती (टेम्पलेट, सेटिंग, मंज़ूरियां) | उस कॉल के लिए बिना sandbox फ़्लैग वाली key इस्तेमाल करें |
404 template_not_found, template_language_not_found | टेम्पलेट का नाम या भाषा गलत है | दोनों GET /templates से कॉपी करें |
422 template_not_approved | Meta ने टेम्पलेट को (अभी तक) मंज़ूर नहीं किया है | मंज़ूरी का इंतज़ार करें, या can_send: true वाला चुनें |
422 template_parameters_invalid, template_parameter_count_mismatch | मानों की संख्या या प्रकार गलत है | details और त्रुटि में दिए example_request से उन्हें ठीक करें |
422 outside_24h_window | उस व्यक्ति को सादा टेक्स्ट, जिसने पिछले 24 घंटों में नहीं लिखा | मंज़ूर किया हुआ टेम्पलेट भेजें |
422 recipient_is_sender | आपने बिज़नेस नंबर पर ही भेज दिया | किसी दूसरे फ़ोन पर भेजें |
403 recipient_opted_out | ग्राहक आपकी Do Not Call सूची में है | उन्हें मार्केटिंग न भेजें |
403 whatsapp_payment_issue | आपके WhatsApp Business Account में वैध भुगतान का तरीका नहीं है (Meta त्रुटि 131042) | WhatsApp Manager में Billing and payments के अंतर्गत एक जोड़ें |
429 rate_limited | इस key के लिए बहुत ज़्यादा कॉल | Retry-After सेकंड रुकें, फिर दोबारा कोशिश करें |
आपके अपने नंबर पर GET /events खाली रहता है | फ़ीड अपनी पहली कॉल से शुरू होती है | भेजने से पहले उसे एक बार कॉल करें (after=now), फिर दोबारा भेजें |
हर जवाब में एक request_id होता है। GET /requests/{id} दिखाता है कि आपके अपने नंबर पर उसके लिए क्या लॉग हुआ, और support@app2email.com भी उसे ढूंढ सकता है। सभी कोड: त्रुटियां।
हस्ताक्षरित webhook पर अपने ही कोड से ग्राहकों को जवाब दें, और किसी व्यक्ति को चैट सौंपें।
utility टेम्पलेट बनाएं, उसे मंज़ूर करवाएं, और हर डिलीवरी को ट्रैक करें।
scoped keys और मंज़ूरियों के साथ Claude या किसी दूसरे एजेंट को अपने नंबर से जोड़ें।
बिना सर्वर लिखे, no-code वर्कफ़्लो से वही कॉल।