# Zipu ozi WhatsApp mbụ gị n'ime nkeji 5

> Nwalee WhatsApp API nke app2email site na igodo instant sandbox na-enweghị akaụntụ, wee jikọta nọmba gị, zipu template mbụ gị, soro steeti ya wee gụọ azịza.

Nduzi a na-eduga gị site na ihe efu gaa na ozi WhatsApp na azịza ya, n'akụkụ abụọ.

**Akụkụ 1, instant sandbox (ihe dị ka nkeji 2, enweghị akaụntụ):** ị na-enweta igodo maka nọmba demo, zipu template gaa onye ahịa ụgha, hụ ka ọ na-aga site na sent ruo read, wee gụọ azịza onye ahịa ahụ. Ihe ọ bụla anaghị aga WhatsApp, mana oku ọ bụla na azịza ọ bụla nwere ụdị API n'ezie, ya mere otu koodu ahụ ga-arụ ọrụ mgbe e mesịrị.

**Akụkụ 2, nọmba gị n'onwe gị:** ị na-debanye aha, jikọta nọmba WhatsApp gị, mepụta API key, wee zipu otu ụdị ozi ahụ gaa ekwentị n'ezie.

**Ihe onye ahịa hụrụ** (Akụkụ 2): ozi WhatsApp site na aha azụmahịa gị, dịka ọmụmaatụ "Ndewo Ava, order #1234 zipuru." Mgbe ha zaghachi, ị nwere ike zaghachi n'ederede nkịtị n'ime awa 24 ndị na-esote.

**Ihe ị na-ahụ:** azịza izipu nwere `message_id`, steeti ozi ahụ (`sent`, `delivered`, `read`), azịza onye ahịa dị ka nhalụ `message.received`, na ozi niile n'app2email Activity Log na Inbox.

## Ihe ị chọrọ

- Maka Akụkụ 1: terminal nwere `curl`, ma ọ bụ Node.js 18+, ma ọ bụ Python 3.9+ nwere `requests`. Ihe ọzọ enweghị.
- Maka Akụkụ 2: nọmba WhatsApp ị nwere ike ijikọta (nke a na-ejighị na app WhatsApp, ma ọ bụ nke ị ga-akwaga), atụmatụ app2email akwụghachi ụgwọ, na API key nwere ikike ndị dị n'okpuru.

| Ikike | Ihe ọ bụ maka nduzi a |
| --- | --- |
| `messages:send` | Zipu template na azịza (`POST /messages`) |
| `messages:read` | Depụta template gị (`GET /templates`), gụọ steeti ozi (`GET /messages/{message_id}`) na ibudata nhalụ (`GET /events`) |
| `webhooks:manage` | Naanị ma ị chọrọ ka a na-ezipu nhalụ gaa sava gị (`POST /webhooks`) |

`GET /me` na-arụ ọrụ site na igodo ọ bụla dị mma, n'agbanyeghị ikike ya.

## Akụkụ 1: instant sandbox

Instant sandbox bụ nọmba demo WhatsApp, `12025550100`, nwere ndị ahịa ụgha ise nke na-eme dịka ndị ahịa n'ezie si eme. Ị chọghị akaụntụ ma ọ bụ igodo iji malite.

Ihe ọ na-enye gị:

- **Igodo ozugbo.** `POST https://api.app2email.com/v1/account/sandbox`, na-enweghị igodo na-enweghị body, na-azaghachi igodo instant sandbox (`a2es_...`). A na-egosi ya otu ugboro ma ọ dị ụbọchị **7**. Ọ na-arụ ọrụ naanị n'nọmba demo.
- **Steeti gị n'onwe gị.** Onye ọ bụla ọzọ anaghị ahụ ozi gị. Ihe ị zipuru ka a na-echekwa ya n'ebe ncheta ruo awa 24 mgbe oku gị ikpeazụ gasịrị.
- **Ndị ahịa ụgha.** Ha bụ naanị nọmba sandbox na-ede ya. Nọmba ọ bụla ọzọ na-azaghachi 422 `sandbox_recipient`.
- **Template atọ:** `hello_world` (`en_US`, UTILITY), `order_update` (`en`, UTILITY) na `weekend_offer` (`en`, MARKETING). A na-enyocha ha site n'otu koodu dịka template n'ezie.
- **Oku ndị a:** `GET /me`, `GET /templates`, `POST /messages`, `GET /messages`, `GET /conversations`, `GET /conversations/{contact}`, `PUT /conversations/{contact}/owner`, `GET /events` na `POST /sandbox/inbound` (na-eme ka onye ahịa ụgha dee gị). Oku ọ bụla ọzọ na-azaghachi 403 `not_in_instant_sandbox`.
- **Oke:** igodo 10 n'otu awa site na otu adreesị. Enweghị webhook, mbugharị media, kọntaktị, mkpọsa ndị na-agba azụ ma ọ bụ izipu e hazi: ndị ahụ chọrọ nọmba ejikọtara. Nhalụ na-abịa site na `GET /events` kama webhook.

<Steps>
  <Step title="Nweta igodo instant sandbox">
    <CodeGroup>

    ```bash cURL
    curl -X POST https://api.app2email.com/v1/account/sandbox
    ```

    ```javascript Node.js
    const 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);
    ```

    ```python Python
    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"])
    ```

    </CodeGroup>

    **Ihe ị na-enweta azụ** (mkpokọta: azịza ahụ na-edepụtakwa oku ndị o nwere na oku ndị a ga-eme tupu ya, na `calls` na `try_first`):

    ```json
    {
      "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"
    }
    ```

    Debe `api_key`: a gaghị egosi ya ọzọ. Ọ bụrụ na ị furu ya efu, nweta ọhụrụ. N'okpuru, `SANDBOX_KEY` na-anọchi ya. Nlele ngwa ngwa na ọ na-arụ ọrụ: `GET https://api.app2email.com/v1/12025550100/me` yana `Authorization: Bearer SANDBOX_KEY`.
  </Step>
  <Step title="Hụ ihe template ahụ chọrọ">
    `GET /templates` na-edepụta template ọ bụla yana uru ya chọrọ na `example_request` zuru ezu ị nwere ike izipu mgbe ị gbanwere uru ndị ahụ.

    <CodeGroup>

    ```bash cURL
    curl https://api.app2email.com/v1/12025550100/templates \
      -H "Authorization: Bearer SANDBOX_KEY"
    ```

    ```javascript Node.js
    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);
    ```

    ```python Python
    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"))
    ```

    </CodeGroup>

    Ihe ọ bụla nwere `name`, `language`, `category`, `status`, `can_send`, `needs` na, maka template e kwadoro, `example_request`. `order_update` chọrọ uru ederede abụọ n'ime body ya: aha onye ahịa na nọmba order.
  </Step>
  <Step title="Zipu template gaa Ava">
    Ava (`12025550101`) na-azaghachi ozi ọ bụla n'ime sekọnd ole na ole. Template bụ ozi ị nwere ike izipu oge ọ bụla, ọbụlagodi onye ahụ na-adụghị dee gị.

    <CodeGroup>

    ```bash cURL
    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" }
            ] }
          ]
        }
      }'
    ```

    ```javascript Node.js
    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);
    ```

    ```python Python
    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"))
    ```

    </CodeGroup>

    **Ihe ị na-enweta azụ** (HTTP 200, mkpokọta): a nabatara ozi ahụ. `text` bụ ozi dị ka onye ahịa hụrụ ya.

    ```json
    {
      "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."
    }
    ```

    Uru ezighi ezi na-alọta dị ka njehie nwere `error.code` nke kwụ ọtọ, `how_to_fix` na, maka njehie template, `example_request` zuru ezu ziri ezi. Nwalee ya: hapụ otu paramita ị ga-enweta 422 `template_parameters_invalid`.
  </Step>
  <Step title="Lee steeti ma gụọ azịza Ava">
    `GET /events?wait=25` na-echere ruo sekọnd 25 maka nhalụ ọzọ, ya mere ị chọghị adreesị ọha. Ị na-enweta `message.status` nwere `sent`, `delivered` na `read`, mgbe ahụ `message.received` nwere azịza Ava.

    <CodeGroup>

    ```bash cURL
    curl "https://api.app2email.com/v1/12025550100/events?wait=25" \
      -H "Authorization: Bearer SANDBOX_KEY"
    ```

    ```javascript Node.js
    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;
    }
    ```

    ```python Python
    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)
    ```

    </CodeGroup>

    **Ihe ị na-enweta azụ** (mkpokọta; okwu Ava na-agbanwe):

    ```json
    {
      "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
    }
    ```

    Nyefee `cursor` dị ka `after` na oku ọzọ iji nweta naanị nhalụ ọhụrụ. Nhalụ ọ bụla bụ otu JSON nke webhook ga-anata n'oge ọzọ, yana otu `id`. `types=message.received` na-enye naanị ozi a na-anata. `GET /messages` na-edepụtakwa ozi, nke a zipuru ọ bụla nwere `status` na `times` ya.
  </Step>
  <Step title="Zaghachi n'ederede nkịtị">
    Ava dere gị ugbu a, ya mere oge awa 24 ya emeghere ma ị nwere ike izipu ederede n'efu:

    ```bash
    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."}}'
    ```

    Otu ederede ahụ gaa Ben (`12025550102`), onye na-adịghị dee ihe, na-azaghachi 422 `outside_24h_window`: n'èzí oge ahụ, naanị template ka a na-ezipu.
  </Step>
</Steps>

### Nwalee ndị ahịa ụgha ndị ọzọ

| Onye ahịa | Zipu ha | Ihe ị ga-amụta |
| --- | --- | --- |
| Ben, `12025550102` | ederede | Ọ na-agụ ma ọ dịghị azaghachi: 422 `outside_24h_window` maka ederede n'efu |
| Cara, `12025550103` | `hello_world` | Nnyefe ada: `message.status` nwere `failed`, na `message.failed` |
| Dan, `12025550104` | `order_update`, mgbe ahụ `weekend_offer` | Ọ zara STOP: `contact.opted_out`, mgbe ahụ template mkpọsa ahịa bụ 403 `recipient_opted_out` |
| Eve, `12025550105` | template ọ bụla | Ọ chọrọ onye mmadụ: nyefee mkparịta ụka site na `PUT /conversations/{contact}/owner` yana `"owner": "human"` |

<Tip>
**Site n'aka AI assistant kama terminal:** Management MCP server `https://api.app2email.com/mcp/manage` nwere ngwá ọrụ `create_sandbox`, igodo instant ahụ na-arụkwa ọrụ na MCP server `https://api.app2email.com/mcp` (`check_key`, `list_templates`, `send_template`, `list_events`, `wait_for_message` ...). Lee [Kwe ka AI agent na-achịkwa WhatsApp gị site na MCP](/guides/how-to-ai-agent-mcp) na [Sandbox](/api/sandbox).
</Tip>

## Akụkụ 2: nọmba gị n'onwe gị

<Steps>
  <Step title="Debanye aha ma jikọta nọmba gị">
    1. Mepụta akaụntụ na [app2email.com/register](https://www.app2email.com/register) wee kwado email gị.
    2. Jikọta nọmba WhatsApp gị site na ụlọ dashboard. Nke a bụ Embedded Signup nke Meta wee chọrọ obere oge.
    3. Họrọ atụmatụ na [peeji ọnụ ahịa](https://www.app2email.com/pricing). Oku API ọ bụla, ma ọ bụ ịgụ ma ọ bụ izipu, chọrọ atụmatụ akwụghachi ụgwọ na ọrụ LIVE.

    Akụkụ Meta na-ekpebi ma ozi na-aga n'ezie: tinye ụzọ ịkwụ ụgwọ na WhatsApp Business Account gị, kwado azụmahịa gị wee kwado aha ngosi gị. [Mmalite](https://www.app2email.com/docs/onboarding) na-eduga gị n'ime ya.
  </Step>
  <Step title="Mepụta API key">
    Na [peeji API key](https://www.app2email.com/dashboard/apikey), mepụta igodo nwere `messages:send` na `messages:read` (tinye `webhooks:manage` ọ bụrụ na ịchọrọ webhook). Igodo (`a2en_...`) a na-egosi ya otu ugboro: debe ya na sava gị, ọ bụghị na ibe weebụ ma ọ bụ log.

    Kpọchie **Sandbox key** mgbe ị mepụtara ya iji nwalee na nọmba gị n'onwe gị tupu: nyocha niile na-arụ n'akaụntụ gị, ihe ọ bụla anaghị aga WhatsApp, azịza nwere `"sandbox": true`, id ozi malite na `wamid.SANDBOX.`, na nhalụ `message.status` ka na-abịa. Mepụta igodo nke abụọ na-enweghị akara ahụ mgbe ị dị njikere izipu n'ezie.
  </Step>
  <Step title="Lelee igodo ahụ">
    N'oku ọ bụla, `YOUR_NUMBER` bụ nọmba WhatsApp ị na-ezipu site na ya: koodu mba mbụ, naanị ọnụọgụ.

    <CodeGroup>

    ```bash cURL
    curl https://api.app2email.com/v1/YOUR_NUMBER/me \
      -H "Authorization: Bearer YOUR_API_KEY"
    ```

    ```javascript Node.js
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/me", {
      headers: { Authorization: `Bearer ${process.env.API_KEY}` },
    });
    console.log(await res.json());
    ```

    ```python Python
    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())
    ```

    </CodeGroup>

    **Ihe ị na-enweta azụ:**

    ```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` ga-abụ `LIVE`, `key.scopes` ga-edepụta ikike ị chọrọ (ma ọ bụ `*` maka nnweta zuru oke). Igodo sandbox na-egosikwa `"sandbox": true`.
  </Step>
  <Step title="Họrọ template e kwadoro">
    `GET /v1/YOUR_NUMBER/templates` na-edepụta template gị. Họrọ otu nwere `"status": "APPROVED"` na `"can_send": true`, wee kopịa `example_request` ya. Enweghị template e kwadoro ka? Mepụta otu na peeji Templates nke dashboard, ma ọ bụ lee [Zipu ozi order na appointment](/guides/how-to-order-notifications) iji mepụta otu site na API wee nweta nkwado ya.
  </Step>
  <Step title="Zipu ya gaa ekwentị gị n'onwe gị">
    Zipu template gaa nọmba ekwentị gị n'onwe gị (ọ bụghị nọmba azụmahịa n'onwe ya: nke ahụ na-azaghachi 422 `recipient_is_sender`). Tinye `Idempotency-Key`: ọ bụrụ na ị nwalaa ọzọ mgbe oge agwụla, ozi ahụ agaghị ezipu ugboro abụọ.

    <CodeGroup>

    ```bash cURL
    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" }
            ] }
          ]
        }
      }'
    ```

    ```javascript Node.js
    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);
    ```

    ```python Python
    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"))
    ```

    </CodeGroup>

    Jiri aha template gị, asụsụ ya na uru ya (`example_request` ya nwere ha). **Ihe ị na-enweta azụ** (HTTP 200):

    ```json
    {
      "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" }]
    }
    ```

    <Tip>
    Tinye `"dry_run": true` n'ime body iji nyochaa ihe niile (uru template, nọmba, ndepụta Do Not Call, oke ọnwa) na-enweghị izipu. Azịza ahụ na-egosi ozi WhatsApp kpọmkwem. Enweghị ihe a na-ezipu, debe ma ọ bụ gụta.
    </Tip>
  </Step>
  <Step title="Gụọ steeti ya">
    `GET /messages/{message_id}` (ikike `messages:read`) na-egosi ebe ozi ahụ nọ. Mee ka id ahụ bụrụ URL-encoded.

    ```bash
    curl "https://api.app2email.com/v1/YOUR_NUMBER/messages/wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA%3D" \
      -H "Authorization: Bearer YOUR_API_KEY"
    ```

    **Ihe ị na-enweta azụ:** `status` bụ otu n'ime `accepted`, `sent`, `delivered`, `read`, `failed`, `deleted`, `queued` ma ọ bụ `unknown`. Nzọụkwụ ndị a ka enweghị ruo ugbu a adịghị na `times`, `reply` na-apụta mgbe onye ahịa zaghachiri ozi a.

    ```json
    {
      "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_..."
    }
    ```
  </Step>
  <Step title="Nata azịza">
    Zaghachi ozi ahụ na ekwentị gị. Ụzọ abụọ iji nweta azịza ahụ n'koodu gị:

    - **Ịchọta ya:** `GET /v1/YOUR_NUMBER/events?wait=25&types=message.received`, dịka na Akụkụ 1. Na nọmba gị n'onwe gị, oku mbụ na-agbanye ibe nhalụ ahụ, nhalụ na-echekwa site na mgbe ahụ ruo awa 72. Ya mere kpọọ ya otu ugboro yana `after=now` tupu izipu, wee debe `cursor`.
    - **Ka a na-ezipu ya:** debanye webhook otu ugboro site na `POST /v1/YOUR_NUMBER/webhooks` na `{"url": "https://your-server.example/webhook"}` (ikike `webhooks:manage`), ma ọ bụ tinye ya na peeji API key n'okpuru Webhooks. app2email mgbe ahụ na-ezipu nhalụ ọ bụla dị ka `POST` nwere akara gaa URL gị. [Wuo chatbot WhatsApp](/guides/how-to-whatsapp-chatbot) nwere onye nnata zuru ezu nwere nyocha akara.

    Azịza na-abịa dị ka `message.received`:

    ```json
    {
      "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"
      }
    }
    ```

    Ị nwere ike izaghachi ugbu a yana `"type": "text"`, dịka n'Akụkụ 1, ruo awa 24 mgbe onye ahịa zipụrụ ozi ikpeazụ.
  </Step>
</Steps>

## Ihe na-eme na WhatsApp

1. Ekwentị gị na-egosi ozi template site na azụmahịa gị, yana aha ngosi gị mgbe Meta kwadoro ya.
2. Koodu gị na-anata nhalụ `message.status`: `sent`, mgbe ahụ `delivered`, mgbe ahụ `read` mgbe ị meghere ya. Ozi dara na-abịa dị ka `message.status` nwere `status: "failed"` na ihe `error`, yana dị ka `message.failed`.
3. Azịza gị na-abịa dị ka `message.received`, oge awa 24 na-emeghe maka nzaghachi nkịtị.
4. Activity Log na Inbox nke dashboard na-egosi ozi abụọ ahụ.

## Nlekọta maka mmepụta

<Check>
**Zipu ozi ọ bụla otu ugboro.** Nye `POST /messages` ọ bụla `Idempotency-Key` nke bụ nke ozi ahụ naanị, dịka nọmba order gị na ihe merenụ. Otu arịrịọ yana otu igodo n'ime awa 24 na-anata azịza mbụ ọzọ, yana isi `Idempotent-Replayed: true`. Otu igodo yana body ọzọ: 422 `idempotency_key_reused`.
</Check>
<Check>
**Hichapụ nhalụ site na `id` ha.** Nhalụ nwere ike ịbịa ọzọ, site na `GET /events` mgbe azịza furu efu, na site na webhook mgbe nnwale ọzọ gasịrị. Debe id ndị ị kpọrọla opekata mpe ụbọchị abụọ.
</Check>
<Check>
**Lelee isi akara webhook.** Nhalụ webhook ọ bụla nwere `X-App2email-Signature: t=<unix seconds>,v1=<hex>`: HMAC-SHA256 nke `t`, otu ntụpọ na raw body, yana secret webhook (`whsec_...`) dị ka igodo. Jụ nhalụ ndị na-adabaghị ma ọ bụ nwere `t` ochie.
</Check>
<Check>
**Kpachara oke ọsọ.** Azịza ọ bụla nwere `X-RateLimit-Limit`, `X-RateLimit-Remaining` na `X-RateLimit-Reset`. Karịa oke, ị na-enweta 429 `rate_limited` yana `Retry-After`: chere ogologo oge ahụ, wee nwaa ọzọ. Iji zipu otu template gaa ọtụtụ nọmba, tinye ha n'otu oku kama oku ọ bụla maka otu.
</Check>
<Check>
**Template n'èzí oge awa 24.** Ederede n'efu na-arụ ọrụ naanị n'ime awa 24 site na ozi ikpeazụ onye ahịa (app2email na-akwụsị nkeji 15 tupu oge). Ihe ọ bụla ọzọ chọrọ template e kwadoro.
</Check>
<Check>
**Zipu naanị ndị kwetara.** A naghị ezipu template mkpọsa ahịa gaa nọmba dị na ndepụta Do Not Call gị, onye ahịa nke dee STOP ka a na-etinye n'ime ya (`contact.opted_out`). [Zipu mkpọsa ahịa nke na-erube isi n'opt-in](/guides/how-to-marketing-broadcast) na-ekwu banyere nkwenye.
</Check>
<Check>
**Debe igodo nzuzo ma nwee naanị ikike chọrọ.** Igodo na sava, ọ bụghị na ibe weebụ. Nye naanị ikike o chọrọ, wee jiri igodo sandbox maka nnwale.
</Check>

## Ọ bụrụ na ọ naghị arụ ọrụ

| Ihe ị hụrụ | Ihe kpatara ya | Ngwọta |
| --- | --- | --- |
| 429 site na `POST /v1/account/sandbox` | Karịa igodo instant sandbox 10 n'otu awa site na adreesị gị | Chere sekọnd `Retry-After`, ma ọ bụ jiri igodo ị nwere (dị ụbọchị 7) |
| 401 `missing_api_key`, `invalid_api_key`, `api_key_expired`, `api_key_revoked` | Enweghị igodo, igodo ezighi ezi, igodo gwụrụ (igodo instant sandbox na-adịru ụbọchị 7) ma ọ bụ igodo kagburu | Zipu `Authorization: Bearer YOUR_API_KEY` yana igodo dị ugbu a; nweta igodo instant ọhụrụ, ma ọ bụ igodo site na peeji API key |
| 403 `api_key_number_mismatch` | Igodo bụ maka nọmba ọzọ karịa nke dị na URL | Tinye nọmba igodo ahụ n'onwe ya na URL. Igodo instant sandbox na-arụ ọrụ naanị na `12025550100` |
| 400 `invalid_number_in_url` | Nọmba dị na URL abụghị ọnụọgụ nwere koodu mba | Jiri nọmba zuru oke, naanị ọnụọgụ, enweghị `+` |
| 403 `not_in_instant_sandbox` | Nọmba demo enweghị oku a (webhook, dịka ọmụmaatụ) | Jiri `GET /events` ebe ahụ, ma ọ bụ igodo sandbox na nọmba gị n'onwe gị |
| 422 `sandbox_recipient` | Instant sandbox na-ede naanị gaa ndị ahịa ụgha ya | Zipu gaa `12025550101` ruo `12025550105` |
| 403 `plan_not_allowed`, `service_not_live` | Enweghị atụmatụ akwụghachi ụgwọ, ma ọ bụ ọrụ akwụsịrị | Họrọ atụmatụ; ọrụ akwụsịrị na-alọ ndụ site na "Go Live" na peeji Settings |
| 403 `insufficient_scope` | Igodo enweghị ikike (`details.required_scope`) | Mepụta igodo nwere `messages:send` na `messages:read` |
| 403 `sandbox_key` | Igodo sandbox enweghị ike ime nke a (template, ntọala, ikwado) | Jiri igodo enweghị akara sandbox maka oku ahụ |
| 404 `template_not_found`, `template_language_not_found` | Aha ma ọ bụ asụsụ template ahụ adịghị mma | Depụta ha abụọ site na `GET /templates` |
| 422 `template_not_approved` | Meta akwadoghị template ahụ (ka) | Chere nkwado, ma ọ bụ họrọ otu nwere `can_send: true` |
| 422 `template_parameters_invalid`, `template_parameter_count_mismatch` | Ọnụọgụ ma ọ bụ ụdị uru ezighi ezi | Dozie ha site na `details` na `example_request` dị na njehie ahụ |
| 422 `outside_24h_window` | Ederede n'efu gaa onye ahịa na-adịghị dee n'ime awa 24 gara aga | Zipu template e kwadoro |
| 422 `recipient_is_sender` | I zipuru nọmba azụmahịa n'onwe ya | Zipu gaa ekwentị ọzọ |
| 403 `recipient_opted_out` | Onye ahịa dị na ndepụta Do Not Call gị | Ekwula izipu ya mkpọsa ahịa |
| 403 `whatsapp_payment_issue` | Enweghị ụzọ ịkwụ ụgwọ dị mma na WhatsApp Business Account gị (njehie Meta 131042) | Tinye otu na WhatsApp Manager n'okpuru Billing and payments |
| 429 `rate_limited` | Oku ndị dị oke maka igodo a | Chere sekọnd `Retry-After`, wee nwaa ọzọ |
| `GET /events` na-anọgide efu na nọmba gị n'onwe gị | Nhalụ na-amalite na oku mbụ ya | Kpọọ ya otu ugboro tupu izipu (`after=now`), wee zipu ọzọ |

Azịza ọ bụla nwere `request_id`. `GET /requests/{id}` na-egosi ihe e debanyere maka ya na nọmba gị n'onwe gị, support@app2email.com nwekwara ike ịchọta ya. Koodu niile: [Njehie](/api/errors).

## Nduzi how-to ndị ọzọ

<CardGroup cols={2}>
  <Card title="Wuo chatbot WhatsApp site na API" href="/guides/how-to-whatsapp-chatbot">
    Zaghachi ndị ahịa site na koodu gị n'otu webhook e bịnyere akara, wee nyefee onye mmadụ.
  </Card>
  <Card title="Zipu ozi order na appointment" href="/guides/how-to-order-notifications">
    Mepụta template UTILITY, nweta ya kwadoro, wee soro nnyefe ọ bụla.
  </Card>
  <Card title="Kwe ka AI agent na-achịkwa WhatsApp gị site na MCP" href="/guides/how-to-ai-agent-mcp">
    Jikọta Claude ma ọ bụ agent ọzọ na nọmba gị site na igodo nwere ikike na nkwado.
  </Card>
  <Card title="Zipu ozi WhatsApp site na n8n, Zapier ma ọ bụ Make" href="/guides/how-to-no-code-n8n-zapier-make">
    Otu oku ahụ site na workflow na-enweghị koodu, na-enweghị ide sava.
  </Card>
</CardGroup>

[Nduzi how-to niile](https://www.app2email.com/docs#how-to)
