# Dlulisa ingxoxo kusuka ebhothini iye kumuntu nakuyo

> Thola lapho ikhasimende le-WhatsApp lidinga umuntu, dlulisela ingxoxo ethimbeni lakho ngesifinyezo, yibelela umuntu, gcina zonke izimpendulo zebhothi ne-AI zithule kuyilapho umuntu ephendula, bese uyibuyisela ebhothini uma isixazululiwe.

Ibhothi isheshe ngemibuzo elula. Ezinye izingxoxo zidinga umuntu: ukubuyiselwa kwemali, isikhalazo, i-oda elihlanganise kabi, noma ikhasimende elibhala nje "can I talk to someone?".

Kule ncwadi yokusebenza ibhothi yakho idlulisela ingxoxo enjalo ethimbeni lakho, bese iyibuyisela ethimbeni lapho lisiqedile.

**Lokho ikhasimende elikubonayo:** licela umuntu, bese ibhothi iphendula ithi "Thanks! A person from our team will answer you here soon." Kusukela lapho, kuphendula ithimba lakho kuphela, kuleyo ngxoxo efanayo ye-WhatsApp. Akukho mpendulo yebhothi noma ye-AI ezingena phakathi.

**Lokho ukubonayo:** ingxoxo ku-Inbox ye-app2email, ibelwe kumuntu oyedwa ethimbeni lakho, nenothi yangaphakathi esho ukuthi ibhothi idlulisele ngani nokuthi ikhasimende libuze ini. Iwebhook yakho ithola isenzakalo ngasinye sokushintsha: ukuthi ngubani onayo ingxoxo, ukuthi ibelwe kubani, nokuthi isixazululwe nini.

## Indlela isebenza ngayo

Yonke ingxoxo (eyodwa ngocingo ngalunye) inomnikazi. Umnikazi utshela ukuthi ngubani ophendula lowo ocingweni njengamanje. Umisa ngocingo olulodwa, `PUT /conversations/{contact}/owner`:

| `owner` | Incazelo | Okwenzekayo |
| --- | --- | --- |
| `""` (ingenalutho) | Ukuqondiswa okujwayelekile | Impendulo yokuzenzakalela yenombolo, izinqubo zokuzenzakalela zengxoxo, izimpendulo ze-AI kanye ne-A2A / OpenClaw agent zisebenza njengoba ukuselile. |
| `agent` | Ukuzenzakalela kuyiphethe | Isimaki sabanye bonke: "ukuzenzakalela kuphatha lo kasodwana". Izimpendulo ze-AI zithula, ngoba zipendula kuphela ingxoxo engenamnikazi. |
| `human` | Umuntu ulinikazi | Impendulo yokuzenzakalela ye-app2email kanye ne-A2A / OpenClaw agent ayiphazamisi lo kasodwana, izimpendulo ze-AI nazo zithula. Ithimba lakho liyaphendula. |
| `paused` | Izimpendulo ezizenzakalelayo ziyamiswa | Okufanayo ne-`human` ngempendulo yokuzenzakalela, ku-A2A / OpenClaw agent nasezimpendulweni ze-AI. |

Ukudluliswa kwemeyili kuqhubeka noma ngubani onomnikazi, ngakho abantu abathola imilayezo ye-WhatsApp ngemeyili bayaqhubeka nokuyithola.

Ukudluliswa kule ncwadi kusebenza kanje:

1. Ikhasimende libhalela inombolo yakho. Iwebhook yakho ithola `message.received`.
2. Ibhothi yakho ifunda ingxoxo (`GET /conversations/{contact}`). Uma umuntu sekunguye onomnikazi, ibhothi ayenzi lutho.
3. Uma ikhasimende licela umuntu, ibhothi isetha umnikazi ku-`human` nge-`reason` ne-`summary`, itshela ikhasimende ukuthi umuntu uzophendula, ibelela ingxoxo umuntu othile ethimbeni bese yengeza inothi yangaphakathi.
4. Umuntu uphendula kusuka ku-Inbox, nge-imeyili noma nge-API.
5. Uma ithimba limaka ingxoxo njengexaziwe, ibhothi isetha umnikazi abuyele ku-`""` bese iphendula umlayezo olandelayo futhi. I-`until_minutes` nayo ingayibuyisela ngokwayo emva kwesikhathi esimisiwe.

<Note>
Iwebhook yakho isathola zonke izenzakalo zenombolo, kuhlanganise ne-`message.received` yengxoxo umuntu ayiphethe. Impendulo yokuzenzakalela ye-app2email, i-A2A / OpenClaw agent kanye nezimpendulo ze-AI zihlola umnikazi ngokwazo. **Nebhothi yakho kufanele iyihlole**, ngaphambi kwanoma iyiphi impendulo.
</Note>

## Okudingekayo

- **Inombolo ye-WhatsApp exhunywe ku-app2email**, ku-plan ekhokhelwayo futhi isebenza. Ngaphandle kwe-plan, zonke izicelo ziphendula nge-403 `plan_not_allowed`; inkonzo emisiwe iphendula nge-403 `service_not_live`. Bona [Ukuqala](https://www.app2email.com/docs/onboarding).
- **Ibhothi etholela imilayezo ku-webhook.** Uma ungakayilungisi, [Yakha ibhothi ye-WhatsApp nge-API](/guides/how-to-whatsapp-chatbot) iyasetha (ithunnel, `POST /webhooks`, imfihlo yokusayina). Lesi siqondiso sengeza ukudluliswa kuleyo bhothi.
- **Ukhiye we-API** osuka [ekhasini lokhiye we-API](https://www.app2email.com/dashboard/apikey) unezimvume ezilandelayo:

| Imvume | Isetshenziselwa ini lapha |
| --- | --- |
| `messages:send` | Setha umnikazi (`PUT /conversations/{contact}/owner`), yabela ingxoxo (`PUT /conversations/{contact}/assignee`), maka njengexaziwe (`PUT /conversations/{contact}/status`), engeza inothi (`POST /conversations/{contact}/notes`), thumela ikhasimende umlayezo (`POST /messages`) |
| `messages:read` | Funda ingxoxo eyodwa (`GET /conversations/{contact}`), uhlu lwezingxoxo, ithimba (`GET /team/members`) kanye nezinothi |
| `webhooks:manage` | Bhalisa iwebhook kanye (`POST /webhooks`), noma uyengeze ekhasini lokhiye we-API |

- **Ukubelwa, izinothi kanye ne-open / solved:** i-team inbox. Ifika ne-Trial ne-Professional plan. Kwamanye ama-plan lezi zingcingo ziphendula nge-403 `team_inbox_not_in_plan`; umnikazi uqobo usebenza kuwo wonke ama-plan akhokhelwayo.

<Tip>
**Ukuzama.** I-**instant sandbox** ayidingi akhawunti: `POST https://api.app2email.com/v1/account/sandbox` (akukho khiye, akukho body) noma ithuluzi `create_sandbox` le-Management MCP server `https://api.app2email.com/mcp/manage` linikeza ukhiye wenombolo yedemo `12025550100`. Ikhasimende lakhe lokuzenzisa `12025550105` licela umuntu, ngakho ungahlola ukutholwa. I-instant sandbox inawo `PUT /conversations/{contact}/owner`, `GET /conversations`, `POST /messages` kanye ne-`GET /events` (funda izenzakalo lapho, ayinawo ama-webhook). Izingcingo zethimba (amalungu, umbelwa, isimo, izinothi) ziphendula nge-403 `not_in_instant_sandbox` lapho. Imininingwane: [Sandbox](/api/sandbox).
</Tip>

<Warning>
**Ukhiye we-sandbox kunombolo yakho** akuthumeli lutho ku-WhatsApp, kodwa umnikazi, umbelwa, isimo kanye nezinothi **yizinguquko zangempela** ezingxoxweni zakho, nakukhiye we-sandbox. Hlola lezi zingcingo kukhasimende lakho, njengefoni yakho.
</Warning>

## Dlulisa, sinyathelo ngesinyathelo

Kuzo zonke izicelo, `YOUR_NUMBER` yinombolo ye-WhatsApp othumela kuyo: ikhodi yezwe iqala, izinombolo kuphela. Ikhasimende yinombolo yalo (ikhodi yezwe iqala) noma i-business-scoped user id yalo (njengo `AU.1234567890123456`), okuyi-`from` noma i-`from_user_id` kusenzakalo.

<Steps>
  <Step title="Funda ukuthi ubani onomnikazi wengxoxo">
    `GET /conversations/{contact}` (scope `messages:read`) ikutshela umnikazi, ukuthi impendulo yombhalo wamahhala ingathunyelwa manje yini, nokuthi kukhona yini izimpendulo zemeyili ezilindile. Ibize ngaphambi kwanoma iyiphi impendulo yebhothi yakho.

    <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>

    **Lokho okuthola emuva** (ingxoxo umuntu ayinikazi):

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

    | Insimu | Lokho okutshela ibhothi yakho |
    | --- | --- |
    | `owner` | `""` ukuqondiswa okujwayelekile, `agent`, `human` noma `paused`. Phendula kuphela uma kuyi-`""` (noma `agent`, uma `agent` eyisimaki sebhothi yakho) |
    | `owner_set_by` | Ngubani owayisethile, njengo `api:Support bot` (igama lokhiye) |
    | `owner_reason`, `owner_summary` | Okunikezwe ngokudluliswa |
    | `owner_until` | Lapho umnikazi wesikhashana ephela khona. Isikhathi esedlule sisho `""` futhi |
    | `owner_set` | Okusethiwe, noma `owner_until` sedlule |
    | `window_state`, `window_open` | `open`: impendulo yombhalo wamahhala ingathunyelwa manje. `closed`: kuphela i-template egunyaziwe |
    | `window_closes_at` | Isikhathi esiqondile lapho iwindi livala ngaso |
    | `held_replies` | `true`: izimpendulo zemeyili ziyalindela ukuthi ikhasimende lithinte "Show reply", ngoba iwindi lamahora angu-24 livalekile |

    Insimu engenalutho ayifakwa empendulweni, ngakho ingxoxo enokuqondiswa okujwayelekile ingaba nezinsimu `owner_*` ngaphandle. Ikhasimende elingakaze libhale liphendula nge-404 `conversation_not_found`.
  </Step>
  <Step title="Qaphela ukuthi ikhasimende lifuna umuntu">
    Ibhothi yakho inquma lokhu kusuka kusenzakalo se-`message.received`. Izimpawu ezintathu zisebenza kahle:

    - **Amagama** emlayezweni wombhalo: "person", "human", "someone", "staff", "manager".
    - **Inkinobho.** Nikeza "Talk to a person" njengenkinobho yokuphendula enesamba lakho. Ukuthepha kufika nge-`type` `interactive` kanye ne-`interactive.id`.
    - **Ibhothi yakho imile**, isibonelo ikhasimende litholile imenyu kabili ngokulandelana, noma lithumele isithombe noma inothi yezwi ibhothi yakho engakwazi ukuyifunda.

    Ukuthepha inkinobho yokuphendula kufika kanje:

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

    Inkinobho uqobo iyisimilayezo sokusebenzelana ejwayelekile, sithunyelwe ngaphakathi kwewindi lamahora angu-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" } }
          ]
        }
      }
    }
    ```

    Usebenzisa izimpendulo ze-AI (umsizi we-app2email) esikhundleni sebhothi yakho? Uyayiqaphela ngokwayo futhi uyadlulisa: bona [Izimpendulo ze-AI ziyadlulisa ngokwazo](#ai-answers-hand-over-by-themselves).
  </Step>
  <Step title="Nikeza ingxoxo umuntu">
    `PUT /conversations/{contact}/owner` (scope `messages:send`) ne-`"owner": "human"`:

    | Insimu | Iyadingeka | Okufakwayo |
    | --- | --- | --- |
    | `owner` | yebo | `human`. Futhi `agent`, `paused`, noma `""` ukubuyela ekujwayelekile |
    | `reason` | cha | Kungani, ngamagama ambalwa (kuze kufike kwezinhlamvu ezingu-200), njengo `customer asked for a person` |
    | `summary` | cha | Ingxoxo ihlobene nani kuze kube manje, ukuze umuntu ayithathe (kuze kufike kwezinhlamvu ezingu-2000). Abantu abafunda imilayezo ye-WhatsApp ngemeyili nabo bayithola |
    | `until_minutes` | cha | 1 kuya ku-43200. Ngemva kwalaa maminithi amaningi umnikazi ubuyela ku-`""` ngokwawo |

    <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>

    **Lokho okuthola emuva** (200): ingxoxo ebuyekeziwe, enezinsimu ezifanayo nesinyathelo 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_..."
      }
    }
    ```

    Kusukela manje impendulo yokuzenzakalela ye-app2email, i-A2A / OpenClaw agent kanye nezimpendulo ze-AI ziyashiya lo kasodwana, futhi wonke amawebhu enombolo athola `conversation.owner_changed`. Ukusetha umnikazi ofanayo futhi akulimazi, ngakho ukuphindwa kwalo cingo kuphephile.

    <Tip>
    Khetha `until_minutes` ukuze ifanele amahora akho okuvula. Nge-480 (amahora angu-8) ingxoxo ongayithathanga ibuyela ebhothini ngokwayo. Yishiye ukuze ugcine ingxoxo nethimba lakhoize kube ukhona umuntu oyibuyisela.
    </Tip>
  </Step>
  <Step title="Tshela ikhasimende">
    Ngenkathi iwindi lamahora angu-24 livulekile (`window_open` ingu-true, futhi kunjalo, ngoba ikhasimende sebebhale), thumela umbhalo omfushane wamahhala nge-`POST /messages`. Nikeza `Idempotency-Key` eyakhiwe kusuka ku-`message_id` yekhasimende, ukuze ukuphindwa kungathumeli kabili.

    <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>

    **Lokho okuthola emuva** (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_..."
    }
    ```

    Iwindi livalile? Ngakho ukuthumela kuphendula nge-422 `outside_24h_window`, futhi i-template egunyaziwe kuphela ingafinyelela ikhasimende.
  </Step>
  <Step title="Yibelela umuntu ethimbeni">
    `GET /team/members` (scope `messages:read`) ikhombisa ubani ongathatha ingxoxo: umnikazi wenombolo kanye namalungu angaphendula (ababoni abangeke babelwe).

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

    **Lokho okuthola emuva:**

    ```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` isho ukuthi umthetho wokubela ngokuzenzakalelayo uyamdlula lowo muntu okwamanje; `in_rotation: true` isho ukuthi i-round robin imnika izingxoxo.

    Bese `PUT /conversations/{contact}/assignee` (scope `messages:send`). `assignee` ithatha:

    - i-`user_id` noma i-`email` kusuka ohlwini,
    - `"auto"`: umthetho wokubela wenombolo ukhetha (round robin phakathi kwamalungu akhethiwe, noma ubuyele kumuntu owaphendula ekugcineni). Uma umthetho uyi-`off`, akukho okushintshayo,
    - `""`: akekho.

    <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>

    **Lokho okuthola emuva:**

    ```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 uthola isaziso sokusunduza (uma esevule izaziso), i-Inbox ibonisa umugqa wesenzo onjengo `API (Support bot) assigned this to Ben`, futhi wonke ama-webhook athola `conversation.assigned`.

    Umnikazi kanye nomuntu obelwe ngingxoxo ezimbili ezihlukene: umnikazi uthi ingabe impendulo ezizenzakalelayo zihlala kude yini, umbelwa uthi ngubani omuntu ethimbeni onayo ingxoxo.
  </Step>
  <Step title="Shiya inothi ethimbeni">
    `POST /conversations/{contact}/notes` (scope `messages:send`) yengeza inothi yangaphakathi: ithimba liyibona kuthi ye-Inbox njengenothi ephuzi, ngokulandelana kwesikhathi nemilayezo. Ikhasimende aliliboni ngakho. 1 kuya ku-4000 wezinhlamvu.

    <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>

    **Lokho okuthola emuva:**

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

    Inothi ayiphindeki: ukuphindwa kuyengeza enye yesibili. Yengeze kanye ngokudluliswa ngakunye (ikhodi engezansi iyenza ngemva kokusetha umnikazi, futhi ayiphindi).
  </Step>
</Steps>

## Phakathi nokuthi umuntu unengxoxo

- **Ithimba lakho liphendula** kusuka ku-Inbox ku-[the dashboard](https://www.app2email.com/dashboard), kusuka kwimeyili (uma ukudluliswa kwemeyili kuvulekile: kuqhubeka noma ubani onomnikazi), noma nge-API nge-`POST /messages`.
- **Ibhothi yakho ithula.** Ifunda `owner` ngaphambi kwanoma iyiphi impendulo futhi ayenzi lutho ngenkathi ku-`human` noma `paused`.
- **Impendulo ezizenzakalelayo ze-app2email kanye ne-A2A / OpenClaw agent** ziyashiya ikhasimende. Ku-A2A / OpenClaw agent lokhu kuncike kumsethingo wenombolo othi `a2a.respect_owner` (uvulekile ngokuzenzakalelayo; `GET /settings/number` iyawukhombisa).
- **Izimpendulo ze-AI** zimpendula ikhasimende kuphela uma ingxoxo ingenamnikazi, akekho ye-app noma i-automation ophendulile, futhi i-AI yeWhatsApp uqobo ingakabambi ingxoxo.
- **Iwindi lamahora angu-24 liyaqhubeka nokubalwa.** Impendulo yombhalo wamahhala womuntu isebenza kuphela uma iwindi livulekile. Impendulo yemeyili ethunyelwe ngemva kokuvala iyabanjwa: `held_replies` kuyi-`true` ku-`GET /conversations/{contact}` kuze kube yilapho ikhasimende lithinta "Show reply". Ngemva kwewindi, kuphela i-template egunyaziwe ingaqala ingxoxo futhi.

`GET /conversations?assignee=k3x9q2m7p4z8w1v&status=open` (scope `messages:read`) ibala izingxoxo ezivulekile zomuntu oyedwa; `assignee=none` ibala ezingabelwanga. Ngayinye inawo `owner` (ingashiywa uma kukhona ukuqondiswa okujwayelekile), `assignee`, `assignee_name`, `status` kanye ne-`window_open`.

## Buyisela ingxoxo ebhothini

Kukhona izindlela ezintathu, futhi ungazisebenzisa zonke:

1. **Ngokucacile**, nge-`PUT /conversations/{contact}/owner` ne-`"owner": ""`. Umuntu angashintsha umnikazi nakudeshibhodi (isenzakalo sibe sithi `set_by` ingu `dashboard`).
2. **Ngesikhathi**, nge-`until_minutes` kusukela ekudluliseni. Ngemva kwalo, i-`owner` ifunda `""` futhi i-`owner_set` isabonisa okwasethwa.
3. **Lapho ithimba limaka ingxoxo njengexaziwe.** `PUT /conversations/{contact}/status` ne-`"status": "solved"` (noma "Solved" ku-Inbox) ithumela `conversation.status_changed`; ibhothi yakho iyisabela ngokusetha umnikazi abuyele ku-`""`.

<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>

**Lokho okuthola emuva** kusukela ocingweni lwesimo:

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

Umlayezo omusha ovela kukhasimende uvula kabusha ingxoxo exaziwe ngokwawo (`conversation.status_changed` nge-`by` `contact`). Ukuthumela impendulo akushintshi isimo.

<Warning>
Ungathathi ingxoxo emuntwini ngokwakho. Yibuyisele kuphela ngesignali ethimba lakho elivumelene ngayo (exaziwe, isikhathi esimisiwe, noma isinqumo somuntu ngokwakhe). `owner_set_by` ikutshela ukuthi ngubani osethe umnikazi.
</Warning>

## Ikhodi ephelele yokudlulisa

Lokhu kwengeza ukudluliswa kwibhothi ye-[Yakha ibhothi ye-WhatsApp nge-API](/guides/how-to-whatsapp-chatbot). Ihlola isayina, ihlehlisa izenzakalo ezisevele zicutshungulwe, ithula lapho umuntu enengxoxo, idlulisela lapho kucelwa, futhi ibuyisela ingxoxo lapho ithimba limaka ngokuthi isixazululiwe. Setha kuqala `NUMBER` (inombolo yakho ye-WhatsApp, izinombolo kuphela), `API_KEY` kanye ne-`WEBHOOK_SECRET` (inani le-`whsec_...` lewebhu yakho).

<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>

**Kungani kwakhiwa ngale ndlela:**

- Umnikazi usethwa **kuqala**. Uma lowo mbizo uhluleka nge-5xx noma umkhawulo wezicelo, ibhothi iphendula nge-503 futhi i-app2email iyithumela kabusha isenzakalo kamuva; akukho okunye okwenziwe kuze kube manje, ngakho ukuphindwa kuqala kuhlanzekile.
- Ngemva kokusetha umnikazi, umlayezo, ukubelwa kanye nenothi kuyinzame **ngokuthembeka ngangokwenzeka**: iphutha liyalogwa, aliphindwa. Ukuphinda isenzakalo sonke kuyofika ku-`owner` `human` kuhlolwa, ngakho lezi zinyathelo ngeke zisebenze kabili naphezu kwalokho.
- `"assignee": "auto"` isebenzisa umthetho wokubela okuzenzakalelayo wenombolo. Ngaphandle kwe-team inbox ku-plan iphendula nge-403 `team_inbox_not_in_plan`, okulogwa; ukudluliswa uqobo kusasebenza.
- Ukubuyisela ingxoxo ngo-"solved" kuthinta kuphela umnikazi onguthi `human`. Ingxoxo ene-`paused` ihlala imisiwe.

## Umphumela

Ku-WhatsApp ikhasimende libona umlayezo walo, bese "Thanks! A person from our team will answer you here soon.", bese impendulo yomuntu ethimbeni lakho. Ku-Inbox ingxoxo ibelwe ku-Ben, nenothi ephuzi phezulu kokudluliswa.

Iwebhook yakho ithola lezi zenzakalo, ngayinye ngenvilophu ejwayelekile (`id`, `type`, `created`, `number`, `data`), nohlobo lwayo nakwikhanda `X-App2email-Event`:

| Isenzakalo | Nini |
| --- | --- |
| `conversation.owner_changed` | Umnikazi ushintshile: human, agent, paused noma ubuyele ekujwayelekile; noma i-AI yeWhatsApp ithathe noma idlulise ingxoxo (umnikazi `whatsapp_ai`) |
| `conversation.assigned` | Ingxoxo inikezwe umuntu ethimbeni, noma akekho: ku-Inbox, ngumthetho wokubela ngokuzenzakalelayo, i-automation, impendulo ye-AI noma i-API |
| `conversation.note_added` | Inothi yangaphakathi yengeziwe (ayithunyelwa kukhasimende) |
| `conversation.status_changed` | Ingxoxo imakiwe njengexaziwe, noma ivulwe kabusha (umuntu, i-API, noma umlayezo omusha ovela kukhasimende) |
| `ai.handover` | Izimpendulo ze-AI zidlulisele ingxoxo kumuntu: umlayezo wokudlulisa wathunyelwa futhi umnikazi waba `human` |
| `message.status` | Umlayezo "umuntu uzophendula" wathunyelwa, walethwa futhi wafundwa |

**Umuntu uthathe** (`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"
  }
}
```

**Ibuyele ebhothini** (isenzakalo esifanayo, umnikazi engenalutho):

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

**Ibelwe** (`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"
  }
}
```

**Imakiwe njengexaziwe** (`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` kanye ne-`set_by` zikutshela ukuthi ngubani owenze ushintsho: `dashboard:<email>`, `api:<key name>` noma `api`, `automation: <rule>`, `ai`, `auto` (umthetho wokubela ngokuzenzakalelayo), noma `contact` (umlayezo omusha wavula kabusha ingxoxo).

<Note>
Incwadi yereferensi ayisho ukuthi isenzakalo siyathunyelwa lapho i-`until_minutes` iphela. Ungathembeli esenzakalweni salokho: funda `owner` nge-`GET /conversations/{contact}` ngaphambi kwanoma iyiphi impendulo, njengoba ikhodi ingenhla iyenza.
</Note>

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

## Izimpendulo ze-AI ziyadlulisa ngokwazo

Uma inombolo isebenzisa **izimpendulo ze-AI** (umsizi we-app2email, ku-plan ye-Professional nakwi-trial) esikhundleni sebhothi yakho, ukudluliswa kwakhiwe ngaphakathi. Umsizi udlulisela ingxoxo kumuntu uma ulwazi lwawo lungamboze umbuzo, ikhasimende licela umuntu, noma isicelo sidinga ithimba. Uthumela umlayezo wokudlulisa, usethe umnikazi ku-`human`, futhi uthumela `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` ingu-null uma umlayezo wokudlulisa ungakwazanga ukuthunyelwa. Umbhalo ikhasimende alithola ungu-`handover_text` ku-`GET /ai-answers/settings` (okungenalutho kusho okuzenzakalelayo; i-`handover_text_sent` ibonisa okuthunyelwayo). Ushintshwa nge-`PUT /ai-answers/settings` (scope `settings:manage`, hhayi ngokhiye we-sandbox).

Imithetho yokuzenzakalela yengxoxo nayo ingadlulisa: "hand to a person" ingesinyathelo esisodwa, eceleni kokubela, kokumaka njengexaziwe nokungeza inothi.

## Vumela ijenti ye-AI yenze ukudluliswa

Iseva ye-MCP `https://api.app2email.com/mcp/conversations` inezingcingo zale ncwadi njengamathuluzi, ngokhiye ofanayo wokugunyaza `Authorization: Bearer`: `get_conversation`, `get_conversation_messages`, `set_conversation_owner`, `list_team_members`, `assign_conversation`, `set_conversation_status`, `add_conversation_note`, `list_conversation_notes`. Iseva egcwele `https://api.app2email.com/mcp` nayo inazo. Bona [Vumela ijenti ye-AI iphathe i-WhatsApp yakho nge-MCP](/guides/how-to-ai-agent-mcp) kanye ne-[MCP](/api/mcp).

Umthetho wamajenti ufana nowebhothi yakho: setha `human` nge-`reason` emfushane kanye ne-`summary` uma ikhasimende licela umuntu noma ijenti ingeke isize, futhi ungathathi ingxoxo ebuyela (`agent` noma `""`) umuntu ayithathile, ngaphandle kokuthi umsebenzisi ukucelile.

## Uhlu lokuhlola lokukhiqiza

<Check>
**Hlola isenzakalo ngasinye.** Ihedha `X-App2email-Signature` ingu-`t=<unix seconds>,v1=<hex>`: i-HMAC-SHA256 ye-`t`, ichaza kanye ne-raw body, ngemfihlo yokusayina yewebhu (`whsec_...`, kanye nesiqalo) njengokhiye. Hlola wonke ama-`v1=` (kunamabili uma imfihlo endala igcinwe ngemva kokushintsha imfihlo), qhathanisa ngesikhathi esifanayo, futhi wenqabe `t` endala (ikhodi ingenhla ivumela imizuzu emi-5). `X-Hub-Signature-256` (`sha256=` ne-HMAC-SHA256 ye-raw body, njengoba i-Meta isayina) nayo ikhona, kuphela nemfihlo yamanje. Okwengeziwe: [Webhooks](/api/webhooks).
</Check>

<Check>
**Phendula ngokushesha futhi ususe okuphindwayo.** Buyisela 2xx ngaphakathi kwemizuzwana engu-10; ukuqondisa kabusha akulandelwa. Isenzakalo esehlulekile sithunyelwa kabusha emva kwe-10 s, 1 min, 5 min, 30 min, 1, 2, 4, 8 kanye ne-16 amahora. I-`id` yesenzakalo (futhi ku-`X-App2email-Delivery`) ifana kuzo zonke izinzame: gcina ama-id owaphathile okungenani izinsuku ezimbili, ku-database noma ku-Redis hhayi enhlokweni.
</Check>

<Check>
**Hlola umnikazi ngaphambi kwanoma iyiphi impendulo.** Phendula kuphela uma i-`owner` ingu-`""` (noma i-marker yakho ye-`agent`). Izenzakalo zingafika sekwephuzile noma ngolunye uhlelo, ngakho funda ingxoxo esikhundleni sokuthembela ku-`conversation.owner_changed` yokugcina owayibona, bese ulungisa izenzakalo ngo-`data.timestamp`.
</Check>

<Check>
**Dlulisa kanye.** Setha umnikazi kuqala; kuphephile ukuphinda. Thumela umlayezo "umuntu uzophendula" nge-`Idempotency-Key` eyakhiwe kusuka ku-`message_id` yekhasimende (ukhiye ofanayo ngaphakathi kwamahora angu-24 awuthunyelwa futhi; impendulo ibuya nge-`Idempotent-Replayed: true`). Izinothi kanye ne-`"assignee": "auto"` aziphindeki: zenze kanye.
</Check>

<Check>
**Hlonipha umkhawulo wezicelo.** Yonke impendulo inawo `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (imizuzwana kuze kugcwale futhi) kanye ne-`X-RateLimit-Policy`. Ngaphezu komkhawulo: 429 `rate_limited` nge-header ethi `Retry-After` kanye ne-`error.retry_after_seconds`; linda leso sikhathi, bese uzama futhi. Okwengeziwe: [Limits](/api/limits).
</Check>

<Check>
**Qaphela iwindi lamahora angu-24.** Umlayezo "umuntu uzophendula" webhothi yakho nezimpendulo zethimba zingemilayezo yombhalo wamahhala: zisebenza kuphela phakathi kwamahora angu-24 kusukela komlayezo wokugcina womkhulumi (i-app2email imisa imizuzu engu-15 ngaphambili; `window_closes_at` yisikhathi esiqondile). Ngemva kwalokho, kuphela i-template egunyaziwe. Uma umuntu evula ingxoxo ngemva kwesikhathi, hlola kuqala i-`window_open`.
</Check>

<Check>
**Hlonipha ukuphuma (opt-out).** Uhlu Lokungashayi (Do Not Call) alisebenzi ezimpendulweni zombhalo wamahhala, ngoba ikhasimende libhalele wena. Isiphambeko: uma umlayezo wokugcina wekhasimende wawungukuphuma uqobo, impendulo iphendula nge-403 `recipient_opted_out` kuze kube yilapho libhala futhi. `contact.opted_out` ikutshela lapho kwenzeka.
</Check>

<Check>
**Omunye umphenduli kunombolo ngayinye.** Impendulo ezizenzakalelayo, ama-automation engxoxo, izimpendulo ze-AI kanye nebhothi yakho kubona yonke imilayezo. Nquma ukuthi ngubani ophendula. Umnikazi we-`agent` ugcina izimpendulo ze-AI kude ngenkathi ibhothi yakho iphatha ikhasimende.
</Check>

<Check>
**Bhala izifinyezo ngabantu.** I-`summary` ifika kubantu abafunda imilayezo ye-WhatsApp ngemeyili, futhi inothi ifundwa ku-Inbox. Zigcine zimfushane futhi zisize: inombolo yoda, into ikhasimende elifuna yona, okuzamile ibhothi kuqala. Ungafaki okuyimfihlo noma imininingwane yokukhokha kuzo.
</Check>

<Check>
**Ukufinyelela okuncane kakhulu.** Ukudluliswa kudinga `messages:send` kanye ne-`messages:read`. Gcina ukhiye kuseva yakho, ungakuze ukubeke ekhasini lewebhu noma ologini. Ukhiye ungakhawulelwa kuma-IP eseva yakho, ube nekhaphu yansuku zonke, noma uphelelwe yisikhathi.
</Check>

## Uma kungasebenzi

| Okubonayo | Kungani | Ukulungisa |
| --- | --- | --- |
| 400 `invalid_owner` | `owner` akuyona `""`, `agent`, `human` noma `paused` | Thumela njengo `{"owner": "human", "reason": "customer asked for a person"}`; ezinye insimu azidingeki |
| 400 `invalid_json` | Umzimba awuyona JSON evumelekile | Hlola amagophe, amakhoma nezibambi |
| 400 `invalid_phone` | Ikhasimende kwi-URL akuyona inombolo noma business-scoped user id | Sebenzisa inombolo ephelele, ikhodi yezwe iqala, noma i-`from_user_id` |
| 404 `conversation_not_found` | Akukho ngxoxo nalelo khasimende okwamanje | Ingxoxo nge-business-scoped user id iqala lapho ikhasimende libhala kunombolo |
| 400 `invalid_assignee` | `assignee` akuyona user id, i-email, `auto` noma `""` | Thatha `user_id` noma `email` ku-`GET /team/members` |
| 422 `not_a_member` | Lowo muntu akasiye umnikazi wenombolo noma ilungu elivumelekile ukuphendula (ababoni abangeke babelwe) | `GET /team/members` ikhombisa abangabelwa |
| 400 `invalid_conversation_status` | `status` akuyona `open` noma `solved` | Thumela `{"status": "solved"}` noma `{"status": "open"}` |
| 400 `invalid_conversation_note` | Inothi ingenalutho noma ide ngaphezu kwezinhlamvu ezingu-4000 | Thumela `{"text": "..."}` nezinhlamvu ezingu-1 kuya ku-4000 |
| 403 `team_inbox_not_in_plan` | Ukubelwa, izinothi kanye ne-open / solved akusona esinombolo ye-plan | Zifika ne-Trial kanye ne-Professional plan; umnikazi usebenza ngaphandle kwazo |
| 503 `team_database_pending` | I-team inbox ilinde ukuthuthukiswa kwe-database ohlangothini lwe-app2email | Zama futhi kamuva; konke okunye kusebenza njengakuqala |
| 403 `insufficient_scope` | Ukhiye awunayo imvume (`details.required_scope`) | Sebenzisa ukhiye one `messages:send` kanye ne-`messages:read` |
| 403 `not_in_instant_sandbox` | Inombolo yedemo ayinalesi cingo (amalungu ethimba, isibonelo) | Sebenzisa ukhiye we-sandbox kunombolo yakho, noma ukhiye ojwayelekile |
| 403 `plan_not_allowed`, `service_not_live` | Awukho ku-plan ekhokhelwayo, noma inkonzo ayisebenzi | Khetha i-plan; inkonzo emisiwe iyavuswa nge-"Go Live" ekhasini le-Settings |
| 422 `outside_24h_window` | Ikhasimende libhale ngaphezu kwamahora angu-24 edlule | Thumela i-template egunyaziwe esikhundleni salokho |
| 403 `recipient_opted_out` | Umlayezo wokugcina wekhasimende kwawuwukuphuma | Ungaphenduli kuze libhale futhi |
| 429 `rate_limited` | Izingcingo eziningi kakhulu kulesi khiye | Linda imizuzwana ye-`Retry-After`, bese uzama futhi |
| Ibhothi isaphendula ngemva kokudluliswa | Ibhothi yakho ayihloli i-`owner`, noma enye indlela yokuphendula isebenza kwinombolo | Funda `GET /conversations/{contact}` ngaphambi kwanoma iyiphi impendulo; hlola impendulo ezizenzakalelayo, ama-automation kanye nezimpendulo ze-AI kudeshibhodi |
| I-A2A / OpenClaw agent isaphendula | Umsethingo wenombolo `a2a.respect_owner` uvaliwe | `GET /settings/number` iyawukhombisa; uvulekile ngokuzenzakalelayo |

Impendulo ngayinye inawo `request_id`. `GET /requests/{request_id}` ikhombisa okulogiwe kuyo (amaphutha nezicelo ezishintsha okuthile, zigcinwe izinsuku ezingu-30), futhi i-support@app2email.com nayo ingayithola. Zonke izikhombisi: [Errors](/api/errors).

## Imibuzo evame ukubuzwa

<AccordionGroup>
  <Accordion title="Kuhluke ini phakathi kwe-human ne-paused?">
    Ezimpendulweni ezizenzakalelayo ze-app2email akukho mehluko: kokubili, impendulo yokuzenzakalela, i-A2A / OpenClaw agent kanye nezimpendulo ze-AI ziyashiya ikhasimende. Sebenzisa `human` uma umuntu enengxoxo, futhi `paused` uma ufuna ukuthi izimpendulo ezizenzakalelayo zime kulelo khasimende isikhashana, isibonelo ngenkathi uhlola okuthile. Kokubili kungaphela ngokwakho nge-`until_minutes`.
  </Accordion>
  <Accordion title="Kusho ini agent, futhi ibhothi yami kufanele yisethe?">
    `agent` isho ukuthi i-automation inikazi ikhasimende. Iyisimaki sabanye bonke, futhi igcina izimpendulo ze-AI kude (zipendula kuphela ingxoxo engenamnikazi). Yisete uma izinhlelo eziningi zibheka inombolo efanayo futhi ufuna zibone ukuthi ibhothi yakho iphakathi komsebenzi nalo khasimende. Setha `""` futhi uma ibhothi isiqedile.
  </Accordion>
  <Accordion title="Iyini owner whatsapp_ai?">
    I-AI yeWhatsApp uqobo ibamba ingxoxo. `conversation.owner_changed` ikutshela lapho ithatha noma idlulisa ingxoxo (`set_by` `whatsapp`, nge-`handover` `control_taken` noma `control_passed`). Kuyilapho ibambe ingxoxo, impendulo idlula kuphela ngemva kokuthi idlulisele ingxoxo phambili.
  </Accordion>
  <Accordion title="Ngingadlulisa ngaphambi kokuthi ikhasimende libhale okokuqala?">
    Yebo, ngenombolo yefoni: inombolo engakaze ixhumane nawe ithola irekhodi lengxoxo, ngakho umnikazi angasethwa kuqala. I-business-scoped user id idinga ukuthi ikhasimende libhale kuqala (404 `conversation_not_found` ngaphandle kwalokho).
  </Accordion>
  <Accordion title="Ngingayihlola kanjani ukutholwa ngaphandle kwenombolo ye-WhatsApp?">
    Yebo. I-instant sandbox (`POST https://api.app2email.com/v1/account/sandbox`, akukho khiye, akukho body) inikeza ukhiye (`a2es_...`, usebenza izinsuku ezingu-7) wenombolo yedemo `12025550100`. Ikhasimende lakhe lokuzenzisa `12025550105` licela umuntu. Funda izenzakalo nge-`GET /events?wait=25` bese usetha umnikazi nge-`PUT /conversations/{contact}/owner`; izingcingo zethimba azikho. Akukho lutho olufika ku-WhatsApp.
  </Accordion>
  <Accordion title="Ngingazithola izenzakalo ngaphandle kwe-URL yomphakathi?">
    Yebo: `GET /events?wait=25` (scope `messages:read`) ibuyisela izenzakalo ofanayo nalezo ze-webhook, nale `id` efanayo. Gcina i-`cursor` yempendulo bese uyidlulisela njenge-`after` ocingweni olulandelayo. [Yakha ibhothi ye-WhatsApp nge-API](/guides/how-to-whatsapp-chatbot) ikhombisa lupu.
  </Accordion>
  <Accordion title="Ngibona kanjani okwenzekile engxoxweni?">
    `GET /conversations/{contact}/notes?include_activity=true` (scope `messages:read`) ibala izinothi, ezidala kuqala, namamugqa esenzo (`assigned`, `unassigned`, `solved`, `reopened`) uma wengeza `include_activity=true`. `GET /conversations/{phone}/messages` ibala imilayezo yazozombili izindlela.
  </Accordion>
</AccordionGroup>

## Eminye imiqondiso yokusebenza

<CardGroup cols={2}>
  <Card title="Yakha ibhothi ye-WhatsApp nge-API" href="/guides/how-to-whatsapp-chatbot">
    Thola imilayezo ku-webhook esayiniwe, bese uyiphendula ngekhodi yakho.
  </Card>
  <Card title="Thumela izaziso zama-oda nezikhathi ngama-template" href="/guides/how-to-order-notifications">
    Ama-template e-utility agunyaziwe okuqinisekisa nezikhumbuzo, nesimo sokulethwa.
  </Card>
  <Card title="Thumela umlayezo wokukhangisa ohlonipha ukuvunywa" href="/guides/how-to-marketing-broadcast">
    Ithemplethi eyodwa kuhlu noma kusegimenti, nezirekhodi zokuvuma nohlu Lokungashayi.
  </Card>
  <Card title="Vumela ijenti ye-AI iphathe i-WhatsApp yakho nge-MCP" href="/guides/how-to-ai-agent-mcp">
    Xhuma i-Claude noma enye ijenti kunombolo yakho nezikhiye ezikhawulelwe nokugunyazwa.
  </Card>
  <Card title="Cela inkokhelo engxoxweni ye-WhatsApp" href="/guides/how-to-payment-links">
    Thumela isixhumanisi sokukhokha engxoxweni bese uzwa lapho sikhokhwa.
  </Card>
</CardGroup>

[Zonke izincwadi zokusebenza](https://www.app2email.com/docs#how-to)
