# Nyefee mkparịta ụka site na bot gị gaa onye mmadụ ma laghachi

> Chọpụta mgbe onye ahịa WhatsApp chọrọ onye mmadụ, nyefee mkparịta ụka ahụ gaa otu gị na nchịkọta, kenye ya ọrụ, debe azịza bot na AI niile ka ha dara jụụ mgbe onye mmadụ na-azaghachi, wee laghachi nye bot mgbe edozila ya.

Bot na-adị ngwa maka ajụjụ dị mfe. Ụfọdụ mkparịta ụka chọrọ onye mmadụ: ego a ga-eweghachi, mkpesa, oder nke jọgburu onwe ya, ma ọ bụ onye ahịa na-ede naanị "enwere m ike ịgwa onye ọ bụla okwu?".

N'ihe ndu a, bot gị na-enyefe mkparịta ụka dị otú ahụ gaa otu gị, ma na-anapụta ya mgbe otu gị emechara.

**Ihe onye ahịa hụrụ:** ọ na-arịọ onye mmadụ, bot ahụ na-aza "Daalụ! Otu onye n'otu anyị ga-aza gị ebe a n'oge na-adịghị anya." Site ya gaa n'ihu naanị otu gị na-azaghachi, n'otu mkparịta ụka WhatsApp ahụ. Azịza bot ma ọ bụ azịza AI adịghị abata n'etiti.

**Ihe ị hụrụ:** mkparịta ụka ahụ n'app2email Inbox, kenyere otu onye n'otu gị, na ihe ndetu dị n'ime nke na-ekwu ihe mere bot ji nyefee ya na ihe onye ahịa jụrụ. Webhook gị na-anata ihe merela maka mgbanwe ọ bụla: onye nwe mkparịta ụka, onye a kenyere ya, na mgbe a dozichara ya.

## Otú ọ si arụ ọrụ

Mkparịta ụka ọ bụla (otu maka onye kọntaktị ọ bụla) nwere **onye nwe**. Onye nwe ahụ na-ekwu onye na-azaghachi onye kọntaktị ahụ ugbu a. Ị na-atọ ya site na otu oku, `PUT /conversations/{contact}/owner`:

| `owner` | Ihe pụtara | Ihe na-eme |
| --- | --- | --- |
| `""` (efu) | Ntụgharị nkịtị | Azịza akpaaka nọmba ahụ, ọrụ akpaaka mkparịta ụka, azịza AI na onye agent A2A / OpenClaw na-arụ ọrụ dịka ị tọọrọ ha. |
| `agent` | Ọrụ akpaaka nwere ya | Akara maka ndị ọzọ: "ọrụ akpaaka na-elekọta onye kọntaktị a". Azịza AI na-ada jụụ, n'ihi na ha na-aza naanị mkparịta ụka enweghị onye nwe. |
| `human` | Onye mmadụ nwere ya | Azịza akpaaka app2email na onye agent A2A / OpenClaw na-ahapụ onye kọntaktị ahụ ka ọ nọrọ n'otu, azịza AI kwekwara otu ahụ. Otu gị na-azaghachi. |
| `paused` | Azịza akpaaka akwụsịla | Otu ihe ahụ dị ka `human` maka azịza akpaaka, onye agent A2A / OpenClaw na azịza AI. |

Nzipu email na-aga n'ihu n'agbanyeghị onye nwe ọ bụla, ya mere ndị na-anata ozi WhatsApp site na email na-aga n'ihu na-anata ha.

Nnyefe n'ihe ndu a na-arụ ọrụ dị otú a:

1. Onye ahịa na-ede ozi gaa nọmba gị. Webhook gị na-anata `message.received`.
2. Bot gị na-agụ mkparịta ụka ahụ (`GET /conversations/{contact}`). Ọ bụrụ na onye mmadụ nwere ya ugbu a, bot ahụ anaghị eme ihe ọ bụla.
3. Ọ bụrụ na onye ahịa jụrụ onye mmadụ, bot ahụ na-atọ onye nwe ka ọ bụrụ `human` nwere `reason` na `summary`, na-agwa onye ahịa na onye mmadụ ga-aza, na-kenye mkparịta ụka ahụ onye n'otu gị ma tinye ihe ndetu dị n'ime.
4. Onye mmadụ na-aza site na Inbox, site na email ma ọ bụ site na API.
5. Mgbe otu gị kpọrọ mkparịta ụka ahụ dị ka edozila, bot ahụ na-atọ onye nwe ka ọ laghachi `""` ma na-aza ozi ọzọ ọzọ. `until_minutes` nwekwara ike ịnyefe mkparịta ụka ahụ n'onwe ya mgbe oge a kpebisiri ike gasịrị.

<Note>
Webhook gị ka na-anata ihe merela niile nke nọmba ahụ, gụnyere `message.received` maka mkparịta ụka onye mmadụ nwere. Azịza akpaaka nke app2email, onye agent A2A / OpenClaw na azịza AI na-enyochakwa onye nwe n'onwe ha. **Bot gị nwekwara ịnyocha ya**, tupu azịza ọ bụla.
</Note>

## Ihe ị chọrọ

- **Nọmba WhatsApp jikọtara ya na app2email**, nke dị na atụmatụ ịkwụ ụgwọ ma dị ndụ. Na-enweghị atụmatụ, oku ọ bụla na-aza 403 `plan_not_allowed`; ọrụ akwụsịrị na-aza 403 `service_not_live`. Lee [Ịmalite](https://www.app2email.com/docs/onboarding).
- **Bot nke na-anata ozi na webhook.** Ọ bụrụ na ịnweghị ya, [Wuo chatbot WhatsApp site na API](/guides/how-to-whatsapp-chatbot) na-etọ ya (tunnel, `POST /webhooks`, nzuzo mbinye aka). Ihe ndu a na-agbakwunye nnyefe n'ime ya.
- **Igodo API** site na [peeji igodo API](https://www.app2email.com/dashboard/apikey) nwere ọkwa ndị a:

| Ọkwa | Ihe ọ bụ maka ya ebe a |
| --- | --- |
| `messages:send` | Tọọ onye nwe (`PUT /conversations/{contact}/owner`), kenye mkparịta ụka (`PUT /conversations/{contact}/assignee`), kpọọ ya dị ka edozila (`PUT /conversations/{contact}/status`), tinye ihe ndetu (`POST /conversations/{contact}/notes`), zipu onye ahịa ozi (`POST /messages`) |
| `messages:read` | Gụọ otu mkparịta ụka (`GET /conversations/{contact}`), ndepụta mkparịta ụka, otu ahụ (`GET /team/members`) na ihe ndetu |
| `webhooks:manage` | Debanye webhook otu ugboro (`POST /webhooks`), ma ọ bụ tinye ya na peeji igodo API |

- **Maka ikenye ọrụ, ihe ndetu na edozila / ka emeghere:** Inbox otu. Ọ na-abịa na atụmatụ Trial na Professional. Na atụmatụ ndị ọzọ, oku ndị a na-aza 403 `team_inbox_not_in_plan`; onye nwe n'onwe ya na-arụ ọrụ na atụmatụ ịkwụ ụgwọ ọ bụla.

<Tip>
**Ịnwale ya.** **Sandbox ozugbo** achọghị akaụntụ: `POST https://api.app2email.com/v1/account/sandbox` (enweghị igodo, enweghị ahịrịokwu) ma ọ bụ ngwaọrụ `create_sandbox` nke sava MCP njikwa `https://api.app2email.com/mcp/manage` na-azaghachi igodo maka nọmba demo `12025550100`. Onye ahịa ụgha ya `12025550105` na-arịọ onye mmadụ, ya mere ị nwere ike ịnwale ịchọpụta ya. Sandbox ozugbo nwere `PUT /conversations/{contact}/owner`, `GET /conversations`, `POST /messages` na `GET /events` (gụọ ihe merela ebe ahụ, ọ nweghị webhook). Oku otu gị (ndị otu, onye a kenyere ọrụ, edozila / ka emeghere, ihe ndetu) na-aza 403 `not_in_instant_sandbox` ebe ahụ. Nkọwa: [Sandbox](/api/sandbox).
</Tip>

<Warning>
**Igodo sandbox na nọmba gị** anaghị izipu ihe ọ bụla gaa WhatsApp, mana onye nwe, onye a kenyere ọrụ, ọnọdụ na ihe ndetu bụ **mgbanwe n'ezie** n'ime mkparịta ụka gị, ọbụlagodi n'igodo sandbox. Nwalee oku ndị ahụ na onye kọntaktị nke gị, dịka ekwentị gị.
</Warning>

## Nyefee, nzọụkwụ site na nzọụkwụ

N'oku ọ bụla, `YOUR_NUMBER` bụ nọmba WhatsApp ị na-ezipu site na ya: koodu mba mbụ, naanị ọnụọgụ. Onye kọntaktị bụ nọmba onye ahịa (koodu mba mbụ) ma ọ bụ id onye ahịa nke azụmahịa kpọchiri (dịka `AU.1234567890123456`), nke bụ `from` ma ọ bụ `from_user_id` nke ihe merela.

<Steps>
  <Step title="Gụọ onye nwe mkparịta ụka">
    `GET /conversations/{contact}` (ọkwa `messages:read`) na-egosi onye nwe, ma enwere ike izipu azịza n'efu ugbu a, na ma email azịza na-echere. Kpọọ ya tupu azịza ọ bụla nke bot gị.

    <CodeGroup>

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

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

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

    </CodeGroup>

    **Ihe ị na-enweta azịghachi** (mkparịta ụka onye mmadụ nwere):

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

    | Ubi | Ihe ọ na-agwa bot gị |
    | --- | --- |
    | `owner` | `""` ntụgharị nkịtị, `agent`, `human` ma ọ bụ `paused`. Zaa naanị mgbe ọ bụ `""` (ma ọ bụ `agent`, ọ bụrụ na `agent` bụ akara bot gị) |
    | `owner_set_by` | Onye tọrọ ya, dịka `api:Support bot` (aha igodo ahụ) |
    | `owner_reason`, `owner_summary` | Ihe e nyere n'ime nnyefe ahụ |
    | `owner_until` | Mgbe onye nwe nwa oge gwụrụ. Oge gafere pụtara na ọ bụ `""` ọzọ |
    | `owner_set` | Ihe e tọrọ, ọbụlagodi mgbe `owner_until` gafere |
    | `window_state`, `window_open` | `open`: enwere ike izipu azịza nkịtị ugbu a. `closed`: naanị template e kwadoro |
    | `window_closes_at` | Oge kpọmkwem windo ahụ na-emechi |
    | `held_replies` | `true`: azịza email na-echere ka onye kọntaktị pịa "Gosi azịza", n'ihi na windo awa 24 emechiela |

    Ubi nke enweghị uru a na-ahapụ ya n'azịza, ya mere mkparịta ụka nwere ntụgharị nkịtị nwere ike ọ gaghị inwe ubi `owner_*` ọ bụla. Onye kọntaktị nke na-adịbeghị ede ozi na-aza 404 `conversation_not_found`.
  </Step>
  <Step title="Chọpụta na onye ahịa chọrọ onye mmadụ">
    Bot gị na-ekpebi nke a site na ihe merela `message.received`. Ihe ịrịba ama atọ na-arụ ọrụ nke ọma:

    - **Okwu** na ozi ederede: "onye mmadụ", "mmadụ", "onye ọ bụla", "ndị ọrụ", "onye nlekọta".
    - **Bọtịnụ.** Nye "Gwa onye mmadụ okwu" dị ka bọtịnụ azịza nwere id gị. Ipi ahụ na-abịa nwere `type` `interactive` na `interactive.id`.
    - **Bot gị ejidere**, dịka onye ahịa nwetara menu ugboro abụọ n'usoro, ma ọ bụ zipụ foto ma ọ bụ ndekọ olu bot gị enweghị ike ịgụ.

    Ipi bọtịnụ azịza na-abịa dị otú a:

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

    Bọtịnụ n'onwe ya bụ ozi interactive nkịtị, a na-ezipu ya n'ime windo awa 24:

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

    Ị na-eji azịza AI (onye enyemaka app2email) kama bot gị? Ọ na-ahụ nke a n'onwe ya ma na-enyefe: lee [Azịza AI na-enyefe n'onwe ha](#ai-answers-hand-over-by-themselves).
  </Step>
  <Step title="Nye onye mmadụ mkparịta ụka ahụ">
    `PUT /conversations/{contact}/owner` (ọkwa `messages:send`) nwere `"owner": "human"`:

    | Ubi | Chọrọ? | Ihe a ga-etinye |
    | --- | --- | --- |
    | `owner` | ee | `human`. Ọzọkwa `agent`, `paused`, ma ọ bụ `""` iji laghachi n'ọnọdụ nkịtị |
    | `reason` | mba | Ihe kpatara ya, n'okwu ole na ole (ruo mkpụrụedemede 200), dịka `customer asked for a person` |
    | `summary` | mba | Ihe mkparịta ụka ahụ metụtara ruo ugbu a, maka onye ga-anara ya (ruo mkpụrụedemede 2000). Ndị na-agụ ozi WhatsApp site na email na-anatakwa ya |
    | `until_minutes` | mba | 1 ruo 43200. Mgbe nkeji ndị a gasịrị, onye nwe ahụ na-alaghachi `""` n'onwe ya |

    <CodeGroup>

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

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

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

    </CodeGroup>

    **Ihe ị na-enweta azịghachi** (200): mkparịta ụka emelitere, nwere otu ubi dị ka nzọụkwụ 1.

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

    Site ugbu a, azịza akpaaka nke app2email, onye agent A2A / OpenClaw na azịza AI na-ahapụ onye kọntaktị a ka ọ nọrọ n'otu, webhook ọ bụla nke nọmba ahụ na-anata `conversation.owner_changed`. Itinye otu onye nwe ọzọ adịghị emerụ ahụ, ya mere ịnwa oku a ọzọ dị nchekwa.

    <Tip>
    Họrọ `until_minutes` dabara na oge ụlọ ọrụ gị na-emeghe. Site na 480 (awa 8) mkparịta ụka nke ọ dịghị onye weere ga-alaghachi nye bot n'onwe ya. Hapụ ya ka ị chọrọ idobe mkparịta ụka ahụ na otu gị ruo mgbe onye ọ bụla nyeghachiri ya.
    </Tip>
  </Step>
  <Step title="Gwa onye ahịa">
    Mgbe windo awa 24 ka meghere (`window_open` bụ true, ọ bụkwa n'ihi na onye ahịa dere ugbu a), zipu ederede nkịtị mkpirikpi site na `POST /messages`. Nye ya `Idempotency-Key` sitere na `message_id` onye ahịa, ka ntụgharị ọ bụla ghara izipu ya 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: handoff-wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=" \
      -d '{"to": "61412345678", "type": "text", "text": {"body": "Thanks! A person from our team will answer you here soon."}}'
    ```

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

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

    </CodeGroup>

    **Ihe ị na-enweta azịghachi** (200):

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

    Windo emechiri? Mgbe ahụ izipu ahụ na-aza 422 `outside_24h_window` ma naanị template e kwadoro nwere ike ịru onye ahịa.
  </Step>
  <Step title="Kenye ya onye n'otu gị">
    `GET /team/members` (ọkwa `messages:read`) na-edepụta onye nwere ike ịnara mkparịta ụka: onye nwe nọmba ahụ na ndị otu nwere ikike izipu azịza (ndị na-ele anya enweghị ike ikenye ọrụ).

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

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

    ```json
    {
      "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` pụtara na iwu ikenye akpaaka na-ahapụ onye ahụ ugbu a; `in_rotation: true` pụtara na ntụgharị n'usoro na-enye ha mkparịta ụka.

    Mgbe ahụ `PUT /conversations/{contact}/assignee` (ọkwa `messages:send`). `assignee` na-ańọ:

    - `user_id` ma ọ bụ `email` sitere na ndepụta ahụ,
    - `"auto"`: iwu ikenye akpaaka nke nọmba ahụ na-ahọrọ (ntụgharị n'usoro n'etiti ndị otu ahọpụtara, ma ọ bụ laghachi nye onye ikpeazụ zaghachiri). Ọ bụrụ na iwu ahụ `off`, ihe ọ bụla agaghị agbanwe,
    - `""`: onye ọ bụla.

    <CodeGroup>

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

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

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

    </CodeGroup>

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

    ```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 na-enweta ọkwa ngwa ngwa (ọ bụrụ na ọ gbanyere ọkwa), Inbox na-egosi akara omume dịka `API (Support bot) assigned this to Ben`, webhook ọ bụla na-anata `conversation.assigned`.

    Onye nwe na onye a kenyere ọrụ bụ ubi abụọ dị iche: onye nwe na-ekwu ma azịza akpaaka ga-ahapụ, onye a kenyere ọrụ na-ekwu onye n'otu nwere mkparịta ụka ahụ.
  </Step>
  <Step title="Hapụ ihe ndetu maka otu gị">
    `POST /conversations/{contact}/notes` (ọkwa `messages:send`) na-agbakwunye ihe ndetu dị n'ime: otu gị na-ahụ ya n'usoro mkparịta ụka Inbox dị ka ihe ndetu odo odo, n'usoro oge yana ozi. Onye ahịa anaghị ahụ ya. Mkpụrụedemede 1 ruo 4000.

    <CodeGroup>

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

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

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

    </CodeGroup>

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

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

    Ihe ndetu anaghị adịgide: ntụgharị ọ bụla na-agbakwunye nke abụọ. Tinye ya otu ugboro maka nnyefe ọ bụla (koodu dị n'okpuru na-eme ya mgbe e tọrọ onye nwe, ọ naghị anwa ya ọzọ).
  </Step>
</Steps>

## Mgbe onye mmadụ nwere mkparịta ụka ahụ

- **Otu gị na-azaghachi** site na Inbox na [dashboard](https://www.app2email.com/dashboard), site na email (mgbe nzipu email dị na ya: ọ na-aga n'ihu n'agbanyeghị onye nwe ọ bụla), ma ọ bụ site na API nwere `POST /messages`.
- **Bot gị na-anọ jụụ.** Ọ na-agụ `owner` tupu azịza ọ bụla ma anaghị eme ihe ọ bụla mgbe ọ bụ `human` ma ọ bụ `paused`.
- **Azịza akpaaka app2email na onye agent A2A / OpenClaw** na-ahapụ onye kọntaktị ka ọ nọrọ n'otu. Maka onye agent A2A / OpenClaw, nke a dabere na nhazi nọmba `a2a.respect_owner` (na-arụ ọrụ n'ihuwa; `GET /settings/number` na-egosi ya).
- **Azịza AI** na-aza onye ahịa naanị mgbe mkparịta ụka enweghị onye nwe, enweghị app ma ọ bụ ọrụ akpaaka zaala, ma AI nke WhatsApp onwe ya ejidebeghị mkparịta ụka ahụ.
- **Windo awa 24 ka na-agụ.** Azịza nkịtị nke onye mmadụ na-arụ ọrụ naanị mgbe windo ka meghere. Azịza email e zipụrụ mgbe ọ mechiri na-echere: `held_replies` bụ `true` na `GET /conversations/{contact}` ruo mgbe onye kọntaktị pịa "Gosi azịza". Mgbe windo gasịrị, naanị template e kwadoro na-amalite mkparịta ụka ọzọ.

`GET /conversations?assignee=k3x9q2m7p4z8w1v&status=open` (ọkwa `messages:read`) na-edepụta mkparịta ụka meghere nke otu onye; `assignee=none` na-edepụta ndị a na-enyeghị ọrụ. Ihe ọ bụla nwere `owner` (a na-ahapụ ya maka ntụgharị nkịtị), `assignee`, `assignee_name`, `status` na `window_open`.

## Nye mkparịta ụka ahụ laghachi nye bot

Enwere ụzọ atọ, ị nwere ike iji ha niile:

1. **Nkọwapụta**, site na `PUT /conversations/{contact}/owner` na `"owner": ""`. Onye mmadụ nwekwara ike ịgbanwe onye nwe na dashboard (ihe merela ahụ wee kwuo `set_by` `dashboard`).
2. **Site na oge**, site na `until_minutes` sitere na nnyefe ahụ. Mgbe ọ gasịrị, `owner` na-agụ `""` ọzọ ma `owner_set` ka na-egosi ihe e tọrọ.
3. **Mgbe otu gị kpọrọ mkparịta ụka dị ka edozila.** `PUT /conversations/{contact}/status` nwere `"status": "solved"` (ma ọ bụ "Solved" na Inbox) na-ezipu `conversation.status_changed`; bot gị na-aza ya site n'itọ onye nwe ka ọ laghachi `""`.

<CodeGroup>

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

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

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

</CodeGroup>

**Ihe ị na-enweta azịghachi** site na oku ọnọdụ:

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

Ozi ọhụrụ sitere n'onye kọntaktị na-emeghe mkparịta ụka edozila ọzọ n'onwe ya (`conversation.status_changed` nwere `by` `contact`). Izipu azịza anaghị agbanwe ọnọdụ.

<Warning>
Ejila mkparịta ụka ahụ laghachi site n'aka onye mmadụ n'onwe gị. Nye ya naanị mgbe otu gị kwekọrọ n'ihe ịrịba ama (edozila, oge kpebisiri ike, ma ọ bụ oku onye mmadụ n'onwe ya). `owner_set_by` na-agwa gị onye tọrọ onye nwe.
</Warning>

## Koodu nnyefe zuru oke

Nke a na-agbakwunye nnyefe na bot nke [Wuo chatbot WhatsApp site na API](/guides/how-to-whatsapp-chatbot). Ọ na-enyocha akara, na-agafe ihe merela e mere, na-anọ jụụ mgbe onye mmadụ nwere mkparịta ụka ahụ, na-enyefe mgbe onye ahịa rịọrọ ya, ma na-anapụta ya mgbe otu gị kpọrọ ya dị ka edozila. Tọọ `NUMBER` (nọmba WhatsApp gị, naanị ọnụọgụ), `API_KEY` na `WEBHOOK_SECRET` (uru `whsec_...` nke webhook gị) tupu.

<Tabs>
  <Tab title="Node.js (Express)">

```javascript handoff.mjs
// 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`));
```

  </Tab>
  <Tab title="Python (Flask)">

```python handoff.py
# 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
```

  </Tab>
</Tabs>

**Ihe mere e ji wuo ya otú a:**

- A na-etọ onye nwe **na mbụ**. Ọ bụrụ na oku ahụ dara site na 5xx ma ọ bụ oke ọnụego, bot ahụ na-aza 503 app2email ga-ezipu ihe merela ahụ ọzọ mgbe e mechara; ihe ọzọ adịghị emecha ruo ugbu a, ya mere ịnwa ọzọ na-amalite ọhụrụ.
- Mgbe e tọrọ onye nwe, ozi, ikenye ọrụ na ihe ndetu bụ **ka ike ga-esi**: a na-edekọ njehie, a naghị anwa ya ọzọ. Ịnwa ọzọ nke ihe merela niile ga-ahụ `owner` `human` ma kwụsị na nlele ahụ, ya mere nzọụkwụ ndị a agaghị agba ugboro abụọ n'ọnọdụ ọ bụla.
- `"assignee": "auto"` na-eji iwu ikenye akpaaka nke nọmba ahụ. Na-enweghị Inbox otu n'atụmatụ, ọ na-aza 403 `team_inbox_not_in_plan`, a na-edekọ ya; nnyefe n'onwe ya ka na-arụ ọrụ.
- Ịlaghachi mkparịta ụka ahụ mgbe "edozila" na-emetụ naanị onye nwe `human`. Mkparịta ụka `paused` na-anọ jụụ.

## Nsonaazụ

Na WhatsApp onye ahịa na-ahụ ozi nke ya, mgbe ahụ "Daalụ! Otu onye n'otu anyị ga-aza gị ebe a n'oge na-adịghị anya.", mgbe ahụ azịza onye mmadụ site n'otu gị. Na Inbox mkparịta ụka ahụ kenyere Ben, na ihe ndetu odo odo dị n'elu nnyefe ahụ.

Webhook gị na-anata ihe merela ndị a, ọ bụla n'ụdị envelopu a na-ejikarị (`id`, `type`, `created`, `number`, `data`), na ụdị ahụ dịkwa na isi `X-App2email-Event`:

| Ihe merela | Mgbe |
| --- | --- |
| `conversation.owner_changed` | Onye nwe gbanwere: human, agent, paused ma ọ bụ laghachi n'ọnọdụ nkịtị; ma ọ bụ AI nke WhatsApp were ma ọ bụ nyefere mkparịta ụka ahụ (onye nwe `whatsapp_ai`) |
| `conversation.assigned` | A nyefere mkparịta ụka ahụ onye n'otu gị, ma ọ bụ onye ọ bụla: na Inbox, site na iwu ikenye akpaaka, ọrụ akpaaka, azịza AI ma ọ bụ API |
| `conversation.note_added` | A gbakwunyere ihe ndetu dị n'ime (a naghị ezipu ya onye kọntaktị ọ bụla) |
| `conversation.status_changed` | A kpọrọ mkparịta ụka dị ka edozila, ma ọ bụ meghee ya ọzọ (site n'aka onye mmadụ, API, ma ọ bụ ozi ọhụrụ sitere n'onye kọntaktị) |
| `ai.handover` | Azịza AI nyefere mkparịta ụka gaa onye mmadụ: ozi nnyefe ezipụrụ ma onye nwe ghọrọ `human` |
| `message.status` | Ozi "onye mmadụ ga-aza" ezipụrụ, rutere ma agụrụ ya |

**Onye mmadụ weere ya** (`conversation.owner_changed`):

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

**Laghachi nye bot** (otu ihe merela ahụ, onye nwe efu):

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

**Ekenyela ọrụ** (`conversation.assigned`):

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

**Edozila** (`conversation.status_changed`):

```json
{
  "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` na `set_by` na-agwa gị onye mere mgbanwe ahụ: `dashboard:<email>`, `api:<key name>` ma ọ bụ `api`, `automation: <rule>`, `ai`, `auto` (iwu ikenye akpaaka), ma ọ bụ `contact` (ozi ọhụrụ meghere mkparịta ụka ahụ ọzọ).

<Note>
Ntụaka a adịghị ekwu na a na-ezipu ihe merela mgbe `until_minutes` gwụrụ. Ejila ihe merela dabere na nke ahụ: gụọ `owner` site na `GET /conversations/{contact}` tupu azịza ọ bụla, dịka koodu dị n'elu si eme.
</Note>

<a id="ai-answers-hand-over-by-themselves"></a>

## Azịza AI na-enyefe n'onwe ha

Ọ bụrụ na nọmba ahụ jiri **azịza AI** (onye enyemaka app2email, na atụmatụ Professional na ule) kama bot gị, nnyefe ahụ dị n'ime ya. Onye enyemaka ahụ na-enyefe mkparịta ụka gaa onye mmadụ mgbe ozi ya adịghị ikwu ajụjụ ahụ, onye ahịa rịọrọ ya, ma ọ bụ ihe a rịọrọ chọrọ otu gị. Ọ na-ezipu ozi nnyefe, na-atọ onye nwe ka ọ bụrụ `human`, ma na-ezipu `ai.handover`:

```json
{
  "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` bụ null mgbe enweghị ike izipu ozi nnyefe ahụ. Ihe onye ahịa nwetara bụ `handover_text` na `GET /ai-answers/settings` (efu pụtara ụdị akọwapụtara; `handover_text_sent` na-egosi ihe a na-ezipu). A na-agbanwe ya site na `PUT /ai-answers/settings` (ọkwa `settings:manage`, ọ bụghị site na igodo sandbox).

Iwu akpaaka nke mkparịta ụka nwekwara ike inyefe: "nyefee onye mmadụ" bụ otu n'ime nzọụkwụ ha, n'akụkụ ikenye ọrụ, kpọrọ dị ka edozila na ịgbakwunye ihe ndetu.

## Kwe ka onye agent AI mee nnyefe

Sava MCP `https://api.app2email.com/mcp/conversations` nwere oku ndị ihe ndu a dị ka ngwaọrụ, nwere otu igodo `Authorization: Bearer`: `get_conversation`, `get_conversation_messages`, `set_conversation_owner`, `list_team_members`, `assign_conversation`, `set_conversation_status`, `add_conversation_note`, `list_conversation_notes`. Sava zuru oke `https://api.app2email.com/mcp` nwekwara ha. Lee [Kwe ka onye agent AI jikwaa WhatsApp gị site na MCP](/guides/how-to-ai-agent-mcp) na [MCP](/api/mcp).

Iwu maka ndị agent bụ otu ihe ahụ dị maka bot gị: tọọ `human` nwere `reason` mkpirikpi na `summary` mgbe onye ahịa rịọrọ onye mmadụ ma ọ bụ agent enweghị ike inyere aka, ejila mkparịta ụka (`agent` ma ọ bụ `""`) onye mmadụ weere laghachi, ọ bụrụ na onye ọrụ achọghị ya.

## Nlekota nke ọrụ

<Check>
**Nyochaa ihe merela ọ bụla.** Isi `X-App2email-Signature` bụ `t=<unix seconds>,v1=<hex>`: HMAC-SHA256 nke `t`, otu akara (.) na ahụ akọrọ, na nzuzo mbinye aka webhook (`whsec_...`, tinyere prefix) dị ka igodo. Nyochaa `v1=` ọ bụla (e nwere abụọ ka a na-edobe nzuzo ochie mgbe a gbanwere nzuzo), jiri oge kwụ ọtọ tụnyere ya, ma jụ `t` ochie (koodu dị n'elu na-ekwe nkeji 5). `X-Hub-Signature-256` (`sha256=` na HMAC-SHA256 nke ahụ akọrọ, dị ka Meta na-ebinye aka) dịkwa, nwere nzuzo ugbu a naanị. Ọzọ: [Webhooks](/api/webhooks).
</Check>

<Check>
**Zaa ngwa ngwa ma wepụ ndabara.** Laghachi 2xx n'ime sekọnd 10; a naghị agbaso ntụgharị. Ihe merela dara ụkwụ a na-ezipu ya ọzọ mgbe sekọnd 10, minit 1, minit 5, minit 30, awa 1, 2, 4, 8 na 16. `id` nke ihe merela (dịkwa na `X-App2email-Delivery`) bụ otu n'ihe nnwale ọ bụla: debe id ndị i mere ruo opekata mpe ụbọchị abụọ, na database ma ọ bụ Redis ọ bụghị n'ebe ncheta.
</Check>

<Check>
**Nyochaa onye nwe tupu azịza ọ bụla.** Zaa naanị mgbe `owner` bụ `""` (ma ọ bụ akara `agent` nke gị). Ihe merela nwekwara ike ibịa mgbe e chere ma ọ bụ n'usoro ụgha, ya mere gụọ mkparịta ụka ahụ kama ịtụkwasị obi `conversation.owner_changed` ikpeazụ ị hụrụ, wee hazie ihe merela site na `data.timestamp`.
</Check>

<Check>
**Nyefee otu ugboro.** Tọọ onye nwe na mbụ; ọ dị nchekwa ịmegharị ya. Zipu ozi "onye mmadụ ga-aza" nwere `Idempotency-Key` sitere na `message_id` onye ahịa (otu igodo n'ime awa 24 agaghị ezipu ọzọ; azịza ahụ ga-alaghachi nwere `Idempotent-Replayed: true`). Ihe ndetu na `"assignee": "auto"` anaghị adịgide: mee ha otu ugboro.
</Check>

<Check>
**Sopụrụ oke ọnụego.** Azịza ọ bụla nwere `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (sekọnd ruo mgbe ọ ga-ejupụta ọzọ) na `X-RateLimit-Policy`. Mgbe ị gafere oke: 429 `rate_limited` nwere isi `Retry-After` na `error.retry_after_seconds`; chere ogologo ahụ, wee nwaa ọzọ. Ọzọ: [Oke](/api/limits).
</Check>

<Check>
**Lezie windo awa 24 anya.** Ozi "onye mmadụ ga-aza" nke bot gị na azịza otu gị bụ ozi nkịtị: ha na-arụ ọrụ naanị n'ime awa 24 site n'ozi ikpeazụ onye ahịa (app2email na-akwụsị nkeji 15 tupu ya; `window_closes_at` bụ oge kpọmkwem). Mgbe ahụ, naanị template e kwadoro. Ọ bụrụ na onye mmadụ weere mkparịta ụka n'oge ọdịda, lelee `window_open` na mbụ.
</Check>

<Check>
**Kwupụta nkwụsị.** Ndepụta Do Not Call anaghị emetụta azịza nkịtị, n'ihi na onye ahịa dere ozi ahụ gị. Ihe ọ bụla ọzọ: mgbe ozi ikpeazụ ya bụ nkwusa ọpụpụ n'onwe ya, azịza na-aza 403 `recipient_opted_out` ruo mgbe ọ ga-edegharị ọzọ. `contact.opted_out` na-agwa gị mgbe ọ na-eme.
</Check>

<Check>
**Otu onye na-azaghachi maka nọmba ọ bụla.** Azịza akpaaka, ọrụ akpaaka mkparịta ụka, azịza AI na bot gị niile na-ahụ otu ozi. Kpebie onye ga-aza. Onye nwe `agent` na-echekwa azịza AI n'ebe ahụ mgbe bot gị na-elekọta onye kọntaktị.
</Check>

<Check>
**Dee nchịkọta maka ndị mmadụ.** `summary` na-erute ndị na-agụ ozi WhatsApp site na email, a na-agụkwa ihe ndetu na Inbox. Debe ha mkpirikpi na ọ bara uru: nọmba oder, ihe onye ahịa chọrọ, ihe bot nwalere n'ihu. Ejila nzuzo ma ọ bụ nkọwa ịkwụ ụgwọ n'ime ha.
</Check>

<Check>
**Ikike kacha nta.** Nnyefe chọrọ `messages:send` na `messages:read` naanị. Debe igodo ahụ n'ihe nkesa gị, ọ bụkwa na ibe weebụ ma ọ bụ ndekọ. Igodo nwere ike ịbụ nke e kpochapụrụ na adreesị IP nke sava gị, nwee oke kwa ụbọchị, ma ọ bụ kwụsị.
</Check>

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

| Ihe ị na-ahụ | Ihe kpatara ya | Ihe a ga-eme |
| --- | --- | --- |
| 400 `invalid_owner` | `owner` abụghị `""`, `agent`, `human` ma ọ bụ `paused` | Zipu dịka `{"owner": "human", "reason": "customer asked for a person"}`; ubi ndị ọzọ bụ nhọrọ |
| 400 `invalid_json` | Ahụ abụghị JSON ziri ezi | Lelee akara okwu, comma na bracket |
| 400 `invalid_phone` | Onye kọntaktị dị na URL abụghị nọmba ma ọ bụ id onye ahịa azụmahịa kpọchiri | Jiri nọmba zuru oke, koodu mba mbụ, ma ọ bụ `from_user_id` |
| 404 `conversation_not_found` | Enweghị mkparịta ụka ya na onye kọntaktị a ruo ugbu a | Mkparịta ụka nwere id onye ahịa azụmahịa kpọchiri na-amalite mgbe onye kọntaktị dere gaa nọmba ahụ |
| 400 `invalid_assignee` | `assignee` abụghị id onye ahịa, email, `auto` ma ọ bụ `""` | Were `user_id` ma ọ bụ `email` sitere na `GET /team/members` |
| 422 `not_a_member` | Onye ahụ abụghị onye nwe nọmba ahụ ma ọ bụ onye otu nwere ikike izipu azịza (ndị na-ele anya enweghị ike ikenye ọrụ) | `GET /team/members` na-edepụta ndị a nwere ike ikenye ọrụ |
| 400 `invalid_conversation_status` | `status` abụghị `open` ma ọ bụ `solved` | Zipu `{"status": "solved"}` ma ọ bụ `{"status": "open"}` |
| 400 `invalid_conversation_note` | Ihe ndetu efu ma ọ bụ karịa mkpụrụedemede 4000 | Zipu `{"text": "..."}` nwere mkpụrụedemede 1 ruo 4000 |
| 403 `team_inbox_not_in_plan` | Ikenye ọrụ, ihe ndetu na mmeghe / edozila adịghị na atụmatụ nọmba ahụ | Ha na-abịa na atụmatụ Trial na Professional; onye nwe na-arụ ọrụ na-enweghị ha |
| 503 `team_database_pending` | Inbox otu na-echere mmelite database n'akụkụ app2email | Nwaa ọzọ mgbe e mechara; ihe ndị ọzọ niile na-arụ ọrụ dị ka tupu ya |
| 403 `insufficient_scope` | Igodo ahụ enweghị ikike (`details.required_scope`) | Jiri igodo nwere `messages:send` na `messages:read` |
| 403 `not_in_instant_sandbox` | Nọmba demo enweghị oku a (oku otu gị, dịka ihe atụ) | Jiri igodo sandbox na nọmba gị, ma ọ bụ igodo nkịtị |
| 403 `plan_not_allowed`, `service_not_live` | Enweghị atụmatụ ịkwụ ụgwọ, ma ọ bụ ọrụ adịghị dị ndụ | Họrọ atụmatụ; ọrụ akwụsịrị na-amalite site na "Go Live" na peeji Settings |
| 422 `outside_24h_window` | Onye ahịa dere ozi ikpeazụ karịa awa 24 gara aga | Zipu template e kwadoro ya |
| 403 `recipient_opted_out` | Ozi ikpeazụ onye ahịa bụ nkwusa ọpụpụ | Azaghị ruo mgbe ọ ga-edegharị ọzọ |
| 429 `rate_limited` | Oku ndị dị ukwuu maka igodo a | Chere sekọnd `Retry-After`, wee nwaa ọzọ |
| Bot ka na-aza mgbe nnyefe gasịrị | Bot gị anaghị enyocha `owner`, ma ọ bụ onye ọzọ na-aza na nọmba ahụ | Gụọ `GET /conversations/{contact}` tupu azịza ọ bụla; lelee azịza akpaaka, ọrụ akpaaka na azịza AI na dashboard |
| Onye agent A2A / OpenClaw ka na-aza | Nhazi nọmba `a2a.respect_owner` akwụsịla | `GET /settings/number` na-egosi ya; ọ na-arụ ọrụ n'ihuwa |

Azịza ọ bụla nwere `request_id`. `GET /requests/{request_id}` na-egosi ihe edekọrọ maka ya (njehie na arịrịọ na-agbanwe ihe, echekwara ụbọchị 30), support@app2email.com nwekwara ike ịchọta ya. Koodu niile: [Njehie](/api/errors).

## Ajụjụ a na-ajụkarị

<AccordionGroup>
  <Accordion title="Gịnị bụ ihe dị iche n'etiti human na paused?">
    Maka azịza akpaaka nke app2email, enweghị ihe dị iche: n'ọnọdụ abụọ ahụ, azịza akpaaka, onye agent A2A / OpenClaw na azịza AI na-ahapụ onye kọntaktị ka ọ nọrọ n'otu. Jiri `human` mgbe onye mmadụ nwere mkparịta ụka, na `paused` mgbe ị chọrọ ka azịza akpaaka kwụsị maka onye kọntaktị a ruo oge ụfọdụ, dịka mgbe ị na-enyocha ihe ọ bụla. Ha abụọ nwere ike ịgwụcha n'onwe ha site na `until_minutes`.
  </Accordion>
  <Accordion title="Gịnị pụtara agent, bot m kwesịrị itọ ya?">
    `agent` na-ekwu na ọrụ akpaaka nwere onye kọntaktị ahụ. Ọ bụ akara maka ndị ọzọ, ma na-echekwa azịza AI n'ebe ahụ (ha na-aza naanị mkparịta ụka enweghị onye nwe). Tọọ ya mgbe sistemụ ụfọdụ na-elekọta otu nọmba ahụ ma ịchọrọ ka ha hụ na bot gị nọ n'etiti ihe ọ bụla na onye kọntaktị a. Tọọ `""` ọzọ mgbe bot ahụ emechara.
  </Accordion>
  <Accordion title="Gịnị bụ onye nwe whatsapp_ai?">
    AI onye agent nke WhatsApp onwe ya na-ejide mkparịta ụka ahụ. `conversation.owner_changed` na-agwa gị mgbe ọ na-were ma ọ bụ nyefee mkparịta ụka ahụ (`set_by` `whatsapp`, nwere `handover` `control_taken` ma ọ bụ `control_passed`). Mgbe ọ na-ejide mkparịta ụka ahụ, azịza ga-aga naanị mgbe ọ nyefere mkparịta ụka ahụ.
  </Accordion>
  <Accordion title="Enwere m ike inyefe tupu onye ahịa edee ozi ọ bụla?">
    Ee, maka nọmba ekwentị: nọmba nke na-adịbeghị ejikọ ya na ihe ọ bụla nwere ndekọ mkparịta ụka, ya mere enwere ike itọ onye nwe na mbụ. Id onye ahịa azụmahịa kpọchiri chọrọ ka onye kọntaktị dee na mbụ (404 `conversation_not_found` ma ọ bụghị ya).
  </Accordion>
  <Accordion title="Enwere m ike ịnwale ịchọpụta ya na-enweghị nọmba WhatsApp?">
    Ee. Sandbox ozugbo (`POST https://api.app2email.com/v1/account/sandbox`, enweghị igodo, enweghị ahịrịokwu) na-enye igodo (`a2es_...`, dị ụbọchị 7) maka nọmba demo `12025550100`. Onye ahịa ụgha ya `12025550105` na-arịọ onye mmadụ. Gụọ ihe merela site na `GET /events?wait=25` wee tọọ onye nwe site na `PUT /conversations/{contact}/owner`; oku otu ahụ adịghị ebe ahụ. Enweghị ihe ọ bụla na-aga WhatsApp.
  </Accordion>
  <Accordion title="Enwere m ike ịnata ihe merela na-enweghị URL ọha?">
    Ee: `GET /events?wait=25` (ọkwa `messages:read`) na-laghachi ihe merela ahụ webhook na-anata, nwere otu `id`. Debe `cursor` nke azịza ahụ ma nyefe ya dị ka `after` na oku ọzọ. [Wuo chatbot WhatsApp site na API](/guides/how-to-whatsapp-chatbot) na-egosi usoro ahụ.
  </Accordion>
  <Accordion title="Olee otú m ga-esi hụ ihe mere n'mkparịta ụka?">
    `GET /conversations/{contact}/notes?include_activity=true` (ọkwa `messages:read`) na-edepụta ihe ndetu, nke ochie n'ihu, nwere akara omume (`assigned`, `unassigned`, `solved`, `reopened`) mgbe ị gbakwunyere `include_activity=true`. `GET /conversations/{phone}/messages` na-edepụta ozi ụzọ abụọ niile.
  </Accordion>
</AccordionGroup>

## Ntuziaka how-to ndị ọzọ

<CardGroup cols={2}>
  <Card title="Wuo chatbot WhatsApp site na API" href="/guides/how-to-whatsapp-chatbot">
    Nata ozi na webhook e bịanyere aka ma zaa ha site na koodu gị.
  </Card>
  <Card title="Zipu ndọta oge na ndụmọdụ site na template" href="/guides/how-to-order-notifications">
    Template ọrụ e kwadoro maka nkwenye na ncheta, yana ọnọdụ nnyefe.
  </Card>
  <Card title="Zipu nkwusa ahịa nke na-asọpụrụ nkwenye" href="/guides/how-to-marketing-broadcast">
    Otu template gaa otu ndepụta ma ọ bụ otu akụkụ, yana ndekọ nkwenye na ndepụta Do Not Call.
  </Card>
  <Card title="Kwe ka onye agent AI jikwaa WhatsApp gị site na MCP" href="/guides/how-to-ai-agent-mcp">
    Jikọọ Claude ma ọ bụ agent ọzọ na nọmba gị site na igodo nwere oke na nkwenye.
  </Card>
  <Card title="Jụọ maka ịkwụ ụgwọ n'ime mkparịta ụka WhatsApp" href="/guides/how-to-payment-links">
    Zipu njikọ ịkwụ ụgwọ n'ime mkparịta ụka ma nụ mgbe a kwụrụ ya.
  </Card>
</CardGroup>

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