app2email API Amanani

Imibhalo

Landela ngokuzenzakalelayo nge-drip sequence

Dala i-drip sequence yezifanekiso ezivunyelwe enokulinda phakathi kwazo, bhalisa amakhasimende amasha, uyimise uma aphendula noma ephuma, bese ulandela umbiko wesinyathelo ngasinye.

Kule ncwadi wakha uchungechunge lwemilayezo emithathu yokwamukela: ukwamukelwa ngosuku lapho ikhasimende lisayina khona, ithiphu yokunakekela ngemuva kwezinsuku ezimbili, nethuba lokuthengisa ngosuku lwesi-7. Uyenza kanye. Emva kwalokho, ikhasimende ngalinye oliBhalisayo lithola imilayezo ngesikhathi salo.

Okubonwa ikhasimende: umlayezo we-WhatsApp usuka kubhizinisi lakho ngemuva nje kokuthi lisayine: "Sawubona Jane, siyakwamukela ku-Green Leaf Plants!" Ezinsukwini ezimbili kuvela isixhumanisi somhlahlandlela wakho wokunakekela izitshalo. Ngosuku lwesi-7 kuvela ikhodi engu-10% yo-oda lwalo olulandelayo. Uma liphendula noma nini, i-sequence iyayeka futhi ithimba lakho lithatha ingxoxo. Uma lithi STOP, aliyi kuthola ukukhangiswa okunye kuwe.

Okubonwa nguwe: kwesinyathelo ngasinye, imilayezo emangalwe, ethunyelwe, elethiwe, efundwe, ehlulekile kanye nelinyiwe. Kwikhasimende ngalinye, izinyathelo alithole, isikhathi esilandelayo elizofika ngaso kanye nesizathu sokuthi liyeke. Izehlakalo ze-webhook zitshela uhlelo lwakho uma ikhasimende liklikela isixhumanisi nalapho liphuma kuyo i-sequence.

Indlela isebenza ngayo

  1. Udala izifanekiso ezintathu bese uyalinda uMeta ukuthi azivumele. I-sequence ithumela izifanekiso kuphela, ngakho isebenza ngaphandle kwewindi lamahora angu-24.
  2. Udala i-sequence nge-POST /sequences: izinyathelo ezingu-1 kuya ku-20, ngasinye kuyisifanekiso namanani aso nethuba.
  3. Ubhalisa oxhumana nabo nge-POST /sequences/{id}/enrolments, noma uvume i-app2email ibhalise bonke abathola ethegi.
  4. I-app2email ithumela isinyathelo ngasinye lapho ithuba lidlule. Ithuba ngalinye libalwa kusukela esinyathelweni esingaphambili; eyokuqala ibalwa kusukela ngomzuzu ikhasimende labhalisiwe ngawo.
  5. Ikhasimende liphuma kwi-sequence uma sonke izinyathelo sekuthunyelwe, uma liphendula (uma ungakuvalanga lokho), uma liphuma, noma uma uliphumisa wena. Iwebhu yakho ithola i-sequence.finished njalo lapho kwenzeka lokho.

Akekho othola lutho uze umbhalise. Ukudala i-sequence akuthumeli lutho.

Okudingayo

  • Inombolo ye-WhatsApp Business API exhunywe ku-app2email, nesevisi ISEBENZA. Ama-drip sequence atholakala kumapulani e-Standard ne-Professional nakuvivinyo; ezinye amapulani aphendula 403 sequences_not_enabled. Inombolo yomuntu siqu ye-WhatsApp exhunywe ngekhodi ye-QR ayikwazi ukuthumela izifanekiso, ngakho ayinazo i-sequence (403 sequence_personal_number).
  • Indlela yokukhokha ku-WhatsApp Business Account yakho ku-Meta. I-Meta iyakhokhisa ngomlayezo ngamunye wesifanekiso oletshiwe.
  • Amakhasimende avumile ukuthola imilayezo kuwe. I-sequence ilandela imithetho efanayo nomsakazo: uhlu Lokungashayi (Do Not Call), umthetho wokuvuma wezifanekiso zokukhangisa, umkhawulo wepulani lakho kanye nomkhawulo wenyanga we-inombolo ngayinye. Bona Thumela umsakazo wokukhangisa ohlonipha ukuvuma ngamarekhodi okuvuma nokuvuma.
  • Ukhiye we-API usuka ku-ikhasi lokhiye we-API onalezi zimvume:
ScopeIsetshenziselwa ukuni kulesi sifundo
templates:manageUkudala izifanekiso ezintathu (POST /templates)
messages:sendUkudala, ukushintsha, ukumisa nokusula i-sequence, ukubhalisa oxhumana nabo nokubakhipha (POST /sequences, PUT /sequences/{id}, DELETE /sequences/{id}, POST /sequences/{id}/enrolments, DELETE /sequences/{id}/enrolments/{contact})
messages:readIsimo sesifanekiso, umbiko we-sequence, ubani osemuva kwayo (GET /templates, GET /sequences/{id}, GET /sequences/{id}/enrolments, GET /broadcasts/{code})
contacts:manageKuphela uma ubhalisa ngethegi: nika oxhumana nabo ithegi (PATCH /contacts/{identity})
webhooks:manageEngeza i-webhook ezothola izehlakalo (POST /webhooks). Ungayengeza futhi ekhasini lokhiye we-API, ngaphandle kwekhodi

GET /v1/YOUR_NUMBER/me ikhombisa izimvume zokhiye osebenzisa.

Tip

Ukuzama kuqala. Ukhiye we-sandbox kwinombolo yakho (ukhiye onesimaki se-sandbox, owenziwe ekhasini lokhiye we-API) ungafunda ama-sequence akho, imibiko yawo kanye nokubhalisa kwawo, futhi i-POST /sequences/{id}/enrolments nge-"dry_run": true ibala abazobhalisa ngaphandle kokubhalisa muntu. Ukudala, ukushintsha nokusula ama-sequence, kanye nokubhalisa okwangempela, kuphendula 403 sandbox_key: sebenzisa ukhiye ojwayelekile kulokho. I-instant sandbox (inombolo yedemo 12025550100 esuka ku-POST https://api.app2email.com/v1/account/sandbox) ayinawo ama-sequence; iphendula 403 not_in_instant_sandbox. Imininingwane: Sandbox.

Isigaba sesinyathelo ngasinye

Isinyathelo ngasinye kuyisifanekiso, futhi uMeta ukhokhisa ngayinye ngokusho isigaba sayo kanye nelizwe lekhasimende. Khetha isigaba esihambisana nalokho umlayezo okushoyo:

UsukuIsinyatheloIsifanekisoIsigaba
0Ukwamukelawelcome_new_customerMARKETING. Ukwamukela kungaba UTILITY kuphela uma kuphathelene ngqo ne-akhawunti noma i-oda ikhasimende elisanda kulenza, ngaphandle kwanto yokukhangisa
2Ithiphu yokunakekelaplant_care_tipsMARKETING. Amathiphu nokuqukethwe akuphathelene nokuthengiselana
7Isiphakamisowelcome_offerMARKETING. Noma yisiphi isaphulelo noma ukukhangisa kuyi-marketing

UMeta ubuyekeza isigaba kanye nesifanekiso, futhi isikhangiso esithunyelwe njenge-UTILITY siyenqatshwa noma sidluliselwe ku-MARKETING. Izifanekiso ze-MARKETING ziya kubantu abangekho ohlwini lwakho Lokungashayi (Do Not Call) kuphela, futhi uma umthetho wokuvuma usebenza, kubantu abanorekhodi lokuvuma kuphela. Linganisa ukuthi uchungechunge lwenze ukuthi ibe nini nge-WhatsApp pricing calculator: izifanekiso ze-marketing ezintathu ngekhasimende ngalinye, ziphindaphindwe ngenani lamakhasimende olindele ngenyanga.

Yakha i-sequence, isinyathelo ngesinyathelo

Zonke izicelo ziya ku-https://api.app2email.com/v1/YOUR_NUMBER nge-Authorization: Bearer YOUR_API_KEY. I-YOUR_NUMBER yinombolo yakho ye-WhatsApp: ikhodi yezwe iqala, izinombolo kuphela.

  1. 1. Dala izifanekiso ezintathu

    Bhala umlayezo ngamunye ngezigcini ezinenombolo, unikeze inani lesampula ngalinye ku-example, bese wengeza umlenze othi indlela yokuyeka. I-STOP namagama awo ezilimi ezahlukene asayaziwa yi-app2email njengamagama okuphuma. Beka zonke izixhumanisi ezigcini, hhayi kumbhalo oqinile: i-app2email inganika ngalinye ikhasimende isixhumanisi salo esilandelwayo (bona isinyathelo 2).

    IsifanekisoUmzimbaAmanani
    welcome_new_customerSawubona {{1}}, siyakwamukela ku-Green Leaf Plants! Sijabule ukuthi usekhona. Phendula lo mlayezo noma nini uma unombuzo.igama
    plant_care_tipsSawubona {{1}}, nansi incwadi yethu esheshayo yokugcina izitshalo zakho ezintsha zijabule: {{2}} Khula uphumelele!igama, isixhumanisi
    welcome_offerSawubona {{1}}, siyabonga ngokusihambela kulesi sonto. Sebenzisa ikhodi {{2}} ukuze uthole okungu-10% ngaphansi ku-oda lakho elilandelayo: {{3}} Ikhodi isebenza izinsuku ezingu-7.igama, ikhodi, isixhumanisi

    Isiphakamiso, njengesicelo esisodwa (ezimbili ezinye zifana nalokhu ngombhalo wazo nezisampula zazo):

    cURL
    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/templates \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "welcome_offer",
        "language": "en",
        "category": "MARKETING",
        "components": [
          {
            "type": "BODY",
            "text": "Hi {{1}}, thanks for being with us this week. Use the code {{2}} for 10% off your next order: {{3}} The code is valid for 7 days.",
            "example": { "body_text": [["Jane", "WELCOME10", "https://www.example.com/shop"]] }
          },
          { "type": "FOOTER", "text": "Reply STOP to opt out" }
        ]
      }'
    Node.js
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/templates", {
      method: "POST",
      headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
      body: JSON.stringify({
        name: "welcome_offer",
        language: "en",
        category: "MARKETING",
        components: [
          {
            type: "BODY",
            text: "Hi {{1}}, thanks for being with us this week. Use the code {{2}} for 10% off your next order: {{3}} The code is valid for 7 days.",
            example: { body_text: [["Jane", "WELCOME10", "https://www.example.com/shop"]] },
          },
          { type: "FOOTER", text: "Reply STOP to opt out" },
        ],
      }),
    });
    console.log(res.status, await res.json());
    Python
    import os, requests
    
    res = requests.post(
        "https://api.app2email.com/v1/YOUR_NUMBER/templates",
        headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
        json={
            "name": "welcome_offer",
            "language": "en",
            "category": "MARKETING",
            "components": [
                {
                    "type": "BODY",
                    "text": "Hi {{1}}, thanks for being with us this week. Use the code {{2}} for 10% off your next order: {{3}} The code is valid for 7 days.",
                    "example": {"body_text": [["Jane", "WELCOME10", "https://www.example.com/shop"]]},
                },
                {"type": "FOOTER", "text": "Reply STOP to opt out"},
            ],
        },
        timeout=10,
    )
    print(res.status_code, res.json())

    Okutholayo (201 Created): isifanekiso sisesandleni sika-Meta ukuze sibuyekezwe.

    {
      "success": true,
      "request_id": "c3ppl",
      "template": {
        "id": "2234567890",
        "name": "welcome_offer",
        "language": "en",
        "category": "MARKETING",
        "status": "PENDING"
      },
      "note": "Submitted to WhatsApp for review (minutes to a day). You get a template.status_changed webhook event with the result, or GET https://api.app2email.com/v1/4976659348270/templates/welcome_offer."
    }

    Ukubuyekezwa kuthatha imizuzu kuya kosuku olulodwa. Isehlakalo se-template.status_changed sikutshela umphumela (status APPROVED ene-can_send: true, noma REJECTED ene-reason), noma ungabuza ku-GET /templates/welcome_offer. Linda kuze kube yizifanekiso zonke ezintathu ziyi-APPROVED ngaphambi kokubhalisa muntu. Ukubuyekezwa kwesifanekiso ngokujulile: Thumela izaziso zomyalelo nokubhukha ngezifanekiso.

  2. 2. Dala i-sequence

    Ukubizwa kanye nezinyathelo ezintathu. Amathuba abalwa kusukela esinyathelweni esingaphambili, ngakho usuku lwesi-7 ngemva kwethiphu yosuku lwesi-2 ku-5 wezinsuku:

    IsinyatheloIthubaIthunyelwa ngalo
    welcome_new_customerwait_days: 0usuku 0, ngemva kokubhalisa
    plant_care_tipswait_days: 2usuku 2
    welcome_offerwait_days: 5usuku 7

    Ithuba linganikezwa njenge-wait_minutes, wait_hours noma wait_days; uma zithunyelwe ndawonye ziyengezwa. Ithuba ngalinye liba phakathi kwezinsuku ezingu-0 kuya ku-90.

    Kumanani esinyathelo, i-{name} yigama lekhasimende. Uma lingaziwa, kusetshenziswa i-name_fallback esikhundleni (okuzenzakalelayo "there"). I-track_clicks ivulekile ngokuzenzakalelayo: yonke ikheli kumanani ingaba yisixhumanisi esilandelwayo esiyedwa ngekhasimende ngalinye, ukuze ubone ukuthi ubani oklikile.

    cURL
    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/sequences \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Welcome series",
        "stop_on_reply": true,
        "steps": [
          { "wait_days": 0, "template_name": "welcome_new_customer", "language": "en",
            "parameters": { "body": ["{name}"], "name_fallback": "there" } },
          { "wait_days": 2, "template_name": "plant_care_tips", "language": "en",
            "parameters": { "body": ["{name}", "https://www.example.com/plant-care"], "name_fallback": "there" } },
          { "wait_days": 5, "template_name": "welcome_offer", "language": "en",
            "parameters": { "body": ["{name}", "WELCOME10", "https://www.example.com/shop"], "name_fallback": "there" } }
        ]
      }'
    Node.js
    const step = (wait_days, template_name, body) => ({
      wait_days, template_name, language: "en", parameters: { body, name_fallback: "there" },
    });
    
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/sequences", {
      method: "POST",
      headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
      body: JSON.stringify({
        name: "Welcome series",
        stop_on_reply: true,
        steps: [
          step(0, "welcome_new_customer", ["{name}"]),
          step(2, "plant_care_tips", ["{name}", "https://www.example.com/plant-care"]),
          step(5, "welcome_offer", ["{name}", "WELCOME10", "https://www.example.com/shop"]),
        ],
      }),
    });
    const { sequence } = await res.json();
    console.log(res.status, sequence.id, sequence.steps.map((s) => s.id));
    Python
    def step(wait_days, template_name, body):
        return {"wait_days": wait_days, "template_name": template_name, "language": "en",
                "parameters": {"body": body, "name_fallback": "there"}}
    
    res = requests.post(
        "https://api.app2email.com/v1/YOUR_NUMBER/sequences",
        headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
        json={
            "name": "Welcome series",
            "stop_on_reply": True,
            "steps": [
                step(0, "welcome_new_customer", ["{name}"]),
                step(2, "plant_care_tips", ["{name}", "https://www.example.com/plant-care"]),
                step(5, "welcome_offer", ["{name}", "WELCOME10", "https://www.example.com/shop"]),
            ],
        },
        timeout=10,
    )
    sequence = res.json()["sequence"]
    print(res.status_code, sequence["id"], [s["id"] for s in sequence["steps"]])

    Okutholayo (201 Created; kufushane kuze kube yisinyathelo sokuqala ku-steps ne-report):

    {
      "success": true,
      "request_id": "s2new",
      "sequence": {
        "id": 12,
        "name": "Welcome series",
        "status": "active",
        "stop_on_reply": true,
        "enrol_tag": "",
        "enrol_tag_since": null,
        "created_by": "api",
        "created_at": "2026-11-19T01:00:00.000Z",
        "updated_at": "2026-11-19T01:00:00.000Z",
        "steps": [
          {
            "id": 31,
            "position": 0,
            "wait_days": 0,
            "wait_minutes": 0,
            "template_name": "welcome_new_customer",
            "language": "en",
            "parameters": { "body": ["{name}"], "name_fallback": "there" },
            "track_clicks": true,
            "report_code": null
          }
        ],
        "counts": { "enrolled": 0, "active": 0, "finished": 0, "stopped": 0, "stopped_by_reply": 0, "opted_out": 0 },
        "report": [
          { "step_id": 31, "position": 0, "template_name": "welcome_new_customer", "posted": 0, "sent": 0, "delivered": 0, "read": 0, "failed": 0, "clicked": 0, "clicks": 0, "report_url": null }
        ]
      }
    }

    Gcina sequence.id kanye nama-id ezinyathelweni: udinga ama-id ezinyathelo ukuze ushintshe izinyathelo kamuva ungalahlekelwa imibiko yazo. Ezimbili ezinye zinyathelo ziphinda ngale ndlela, nge-wait_minutes 2880 nge-7200. I-stop_on_reply ivulekile ngokuzenzakalelayo; ukuphuma kuyeka ikhasimende noma ngabe lithini. Inombolo ingaba nama-sequence angu-100 kuya phezulu.

    Note

    I-POST /sequences ayithathi Idempotency-Key. Uma impendulo ilahleka, buka i-GET /sequences ngaphambi kokuphinda ukudala, ukuze ungabi namabili.

  3. 3. Bhalisa oxhumana nabo bokuqala

    Thumela izinombolo (numbers), izinombolo namagama (contacts), wonke oxhumana nabo besegmenti elonga (segment_id) noma wonke oxhumana nabo abanethegi (tag), kufika kwabangu-5000 ngesicelo ngasinye. Qala nge-"dry_run": true: ibala abazobhalisa futhi ayibhalisi muntu.

    cURL
    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/sequences/12/enrolments \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contacts": [
          { "number": "61412345678", "name": "Jane" },
          { "number": "61498765432", "name": "Tom" }
        ],
        "dry_run": true
      }'
    Node.js
    async function enrol(sequenceId, contacts, dryRun = false) {
      const res = await fetch(`https://api.app2email.com/v1/YOUR_NUMBER/sequences/${sequenceId}/enrolments`, {
        method: "POST",
        headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
        body: JSON.stringify({ contacts, dry_run: dryRun }),
      });
      return res.json();
    }
    
    const contacts = [{ number: "61412345678", name: "Jane" }, { number: "61498765432", name: "Tom" }];
    console.log(await enrol(12, contacts, true)); // count only
    console.log(await enrol(12, contacts));       // for real
    Python
    def enrol(sequence_id, contacts, dry_run=False):
        res = requests.post(
            f"https://api.app2email.com/v1/YOUR_NUMBER/sequences/{sequence_id}/enrolments",
            headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
            json={"contacts": contacts, "dry_run": dry_run},
            timeout=10,
        )
        return res.json()
    
    contacts = [{"number": "61412345678", "name": "Jane"}, {"number": "61498765432", "name": "Tom"}]
    print(enrol(12, contacts, dry_run=True))  # count only
    print(enrol(12, contacts))                # for real

    Okutholayo (200, isakhiwo esifanayo nangaphandle kwe-dry_run nangaphakathi kwayo):

    {
      "success": true,
      "request_id": "s7enr",
      "sequence_id": 12,
      "enrolled": 2,
      "already_in_it": 0,
      "on_do_not_call_list": 0,
      "not_a_number": 0,
      "first_step_at": "2026-11-19T01:00:00.000Z",
      "note": null
    }

    Bese uthumela umzimba ofanayo ngaphandle kwe-dry_run. Oxhumana nabo abasohlwini Lokungashayi (Do Not Call), oxhumana nabo abasevele kule sequence kanye nanoma yini engeyinombolo yocingo ayadlulwa futhi ayabalwa. Lokho kwenza isicelo siphephe ukuphindwa: ikhasimende alibhalisweli kabili. I-first_step_at yisikhathi isinyathelo sokuqala esiphuma ngaso.

    Ekhodini lakho lokubhalisa, bhalisa ikhasimende ngalinye elisanda ukuzibhalisa, negama lalo, ukuze ukwamukela kufike masinyane.

  4. 4. Engeza i-webhook yezehlakalo

    Isicelo esisodwa (noma ungayengeza ekhasini lokhiye we-API ngaphansi kwe-Webhooks). Gcina imfihlo ye-whsec_... kwimpendulo: isayina wonke amacala.

    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/webhooks \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"url": "https://www.example.com/whatsapp/webhook"}'

    Yonke i-webhook ithola zonke izinhlobo zezehlakalo; ikhodi yakho ikhetha i-sequence.finished, i-link.clicked nezinye ezingezansi ngokusebenzisa type, bese iphendula ngo-2xx kwezinye ngaphakathi kwemizuzwana engu-10. Ukuyisetha nokuhlola isignesha, nethuluzi lekhompyutha yakho: Yakha i-WhatsApp chatbot nge-API.

    Awunalo ikheli lomphakathi? GET /events?wait=25&types=sequence.finished (scope messages:read) ithola izehlakalo ezifanayo.

  5. 5. Landela inqubekelaphambili

    GET /sequences/{id} inezibalo nombiko wesinyathelo ngasinye. GET /sequences/{id}/enrolments inezibalo zikhasimende ngalinye.

    cURL
    curl https://api.app2email.com/v1/YOUR_NUMBER/sequences/12 \
      -H "Authorization: Bearer YOUR_API_KEY"
    
    # who is still in it, with the next step and when it is due
    curl "https://api.app2email.com/v1/YOUR_NUMBER/sequences/12/enrolments?status=active&limit=100" \
      -H "Authorization: Bearer YOUR_API_KEY"
    Node.js
    const headers = { Authorization: `Bearer ${process.env.API_KEY}` };
    const { sequence } = await (await fetch("https://api.app2email.com/v1/YOUR_NUMBER/sequences/12", { headers })).json();
    console.log(sequence.counts);
    for (const row of sequence.report) console.log(row.template_name, row.delivered, row.read, row.clicked);
    
    const { enrolments } = await (await fetch(
      "https://api.app2email.com/v1/YOUR_NUMBER/sequences/12/enrolments?status=active&limit=100", { headers })).json();
    for (const e of enrolments) console.log(e.contact, e.steps_sent, e.next_at);
    Python
    headers = {"Authorization": f"Bearer {os.environ['API_KEY']}"}
    sequence = requests.get("https://api.app2email.com/v1/YOUR_NUMBER/sequences/12", headers=headers, timeout=10).json()["sequence"]
    print(sequence["counts"])
    for row in sequence["report"]:
        print(row["template_name"], row["delivered"], row["read"], row["clicked"])
    
    enrolments = requests.get("https://api.app2email.com/v1/YOUR_NUMBER/sequences/12/enrolments",
                              params={"status": "active", "limit": 100}, headers=headers, timeout=10).json()["enrolments"]
    for e in enrolments:
        print(e["contact"], e["steps_sent"], e["next_at"])

    Okutholayo kusuka ku-GET /sequences/12 ngemva kweviki (kufushane: steps ishiyiwe):

    {
      "success": true,
      "request_id": "s3get",
      "sequence": {
        "id": 12,
        "name": "Welcome series",
        "status": "active",
        "stop_on_reply": true,
        "enrol_tag": "",
        "counts": { "enrolled": 120, "active": 64, "finished": 31, "stopped": 25, "stopped_by_reply": 21, "opted_out": 3 },
        "report": [
          { "step_id": 31, "position": 0, "template_name": "welcome_new_customer", "posted": 120, "sent": 120, "delivered": 118, "read": 97, "failed": 2, "clicked": 0, "clicks": 0,
            "report_url": "https://www.app2email.com/dashboard/log/broadcast/k3XbQ9rTzP2mWv7a1c9e" },
          { "step_id": 32, "position": 1, "template_name": "plant_care_tips", "posted": 81, "sent": 81, "delivered": 80, "read": 66, "failed": 0, "clicked": 29, "clicks": 41,
            "report_url": "https://www.app2email.com/dashboard/log/broadcast/m7TqW2xRb9LpZc4d8e1f" },
          { "step_id": 33, "position": 2, "template_name": "welcome_offer", "posted": 34, "sent": 34, "delivered": 34, "read": 30, "failed": 0, "clicked": 12, "clicks": 15,
            "report_url": "https://www.app2email.com/dashboard/log/broadcast/p2HsK8vYc3NwQf6g9h2j" }
        ]
      }
    }
    • counts: ukuthi bangaki ababhalisiwe, bangaki basasemuva kwayo, bangaki abathole zonke izinyathelo (finished), noma bangaki abaphume kusenesikhathi (stopped, lapho stopped_by_reply ibala abaphendulile kanye opted_out ibala abaphumile).
    • report, ngesinyathelo ngasinye: posted, sent, delivered, read, failed, kanye ne-clicked (oxhumana nabo abaklikile isixhumanisi esilandelwayo sesinyathelo; i-clicks ibala yonke imiklikelo).
    • Isinyathelo ngasinye sinaye report_code ku-steps ngemva kokuthunyelwa kokuqala. I-GET /broadcasts/{code} nayo inikeza umphumela walelo sinyathelo ngenombolo ngayinye, njengombiko womsakazo; i-report_url iyivula ku-dashboard.

    Ukubhalisa okukodwa kusuka ku-GET /sequences/12/enrolments:

    {
      "success": true,
      "request_id": "s6enl",
      "sequence_id": 12,
      "enrolments": [
        {
          "id": 501,
          "contact": "61412345678",
          "name": "Jane",
          "status": "active",
          "stop_reason": null,
          "steps_sent": 1,
          "next_step": 2,
          "next_at": "2026-11-21T01:00:00.000Z",
          "last_sent_at": "2026-11-19T01:00:00.000Z",
          "enrolled_at": "2026-11-19T01:00:00.000Z",
          "enrolled_by": "api",
          "finished_at": null,
          "history": [
            { "step": 31, "position": 0, "at": "2026-11-19T01:00:00.000Z", "ok": true, "error": "" }
          ]
        }
      ]
    }

    I-status ingu-active, finished noma stopped; i-stop_reason ichaza ukuthi ikhasimende liphume ngenxa yani. I-history inayo yonke imizamo yesinyathelo ngasinye: ok: false ene-error uma isinyathelo singaphumanga. I-limit ingu-1 kuya ku-500 (okuzenzakalelayo 100), okokugcina kuqala.

Umphumela

Ku-Jane, ebhalisiwe ngo-19 November:

Usuku 0: "Sawubona Jane, siyakwamukela ku-Green Leaf Plants!" lifika masinyane ngemva kokuthi azibhalise. Iwebhu yakho ithola izehlakalo message.status zalo (sent, delivered, read), njengakunoma iyiphi imilayezo.

Usuku 2: ithiphu yokunakekela iyafika. Isixhumanisi sayo siwukuthi esakhe alilandelayo (https://www.app2email.com/l/...). Uma alivula, iwebhu yakho ithola i-link.clicked ne-sequence nesinyathelo:

{
  "id": "evt_Cmp3k9m2Lw8Rt5Yp1Zs03",
  "type": "link.clicked",
  "created": "2026-11-21T08:12:00.000Z",
  "number": "4976659348270",
  "data": {
    "contact": "61412345678",
    "url": "https://www.example.com/plant-care",
    "broadcast_code": null,
    "sequence_id": 12,
    "step_id": 32,
    "first_click": true,
    "clicks": 1,
    "browser": "Safari",
    "timestamp": "2026-11-21T08:12:00.000Z"
  }
}

I-link.clicked iza ngomklikelo ngamunye; i-first_click ingu-true kuphela ngowokuqala kuye. Izibonelo zesixhumanisi nabahambi bewebhu ababalwa.

Usuku 7: isiphakamiso siyafika. Uma kwakuyisinyathelo sokugcina, iwebhu yakho ithola i-sequence.finished ene-result completed:

{
  "id": "evt_Cmp3k9m2Lw8Rt5Yp1Zs02",
  "type": "sequence.finished",
  "created": "2026-11-26T01:00:00.000Z",
  "number": "4976659348270",
  "data": {
    "sequence_id": 12,
    "sequence": "Welcome series",
    "contact": "61412345678",
    "result": "completed",
    "reason": null,
    "steps_sent": 3,
    "steps": 3,
    "enrolled_at": "2026-11-19T01:00:00.000Z",
    "by": "api",
    "timestamp": "2026-11-26T01:00:00.000Z"
  }
}

Uma eshaya impendulo ngosuku 3 ("Ningalethela ngeMgqibelo?"), iwebhu yakho ithola i-message.received, ingxoxo yakhe ivela ku-Inbox, futhi isiphakamiso asithunyelwa. I-sequence.finished ifika ene-result stopped, ne-reason replied kanye ne-steps_sent 2. Umuntu (noma i-bot yakho) umphendula ngaphakathi kwewindi lamahora angu-24 avulwe umlayezo wakhe. Bona Nikezela ingxoxo kusuka ku-bot yakho kuya komuntu nakabuye.

Uma eshaya STOP (noma ecindezela "Stop promotions"), ufakwa ohlwini Lokungashayi (Do Not Call) masinyane. Iwebhu yakho ithola i-contact.opted_out, ne-sequence.finished ene-reason opted_out.

Zonke izizathu ze-result stopped:

reasonKwenzekeni
repliedIxhumana naye ubhalele emuva (kuphela uma i-stop_on_reply ivulekile)
opted_outIxhumana naye uphume
removedUyimise nge-DELETE /sequences/{id}/enrolments/{contact}
sequence_deletedUsule i-sequence
failed, not_allowedIsinyathelo asikwazanga ukuthunyelwa kulo xhumana naye. I-history yokubhalisa inayo i-error yesinyathelo

Shintsha, misa noma yima

Misa bonke lapho babe khona nge-PUT /sequences/{id} kanye ne-{"status": "paused"}; i-{"status": "active"} iqhubeka. Thumela okushintshayo kuphela. Impendulo i-sequence yonke.

curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/sequences/12 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "paused"}'

Shintsha izinyathelo nge-steps kulesi sicelo. Lokho kuyashintsha uhlu lonke, ngokulandelana: thumela i-id yesinyathelo ukuze uyigcine nombiko waso, isinyathelo esingenayo i-id siyasha, nesinyathelo oshiya ngaphandle siyasulwa. Oxhumana nabo abase bedlulile isinyathelo sokugcina baqeda. Lapha isiphakamiso sishintshela kusuku lwesi-7 kuya kolwesi-10:

curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/sequences/12 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "steps": [
      { "id": 31, "wait_days": 0, "template_name": "welcome_new_customer", "language": "en", "parameters": { "body": ["{name}"] } },
      { "id": 32, "wait_days": 2, "template_name": "plant_care_tips", "language": "en", "parameters": { "body": ["{name}", "https://www.example.com/plant-care"] } },
      { "id": 33, "wait_days": 8, "template_name": "welcome_offer", "language": "en", "parameters": { "body": ["{name}", "WELCOME10", "https://www.example.com/shop"] } }
    ]
  }'

Khipha oxhumana naye oyedwa, isibonelo uma ethenga ngaphambi kokuthi isiphakamiso sifike:

curl -X DELETE https://api.app2email.com/v1/YOUR_NUMBER/sequences/12/enrolments/61412345678 \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "success": true,
  "request_id": "s8rem",
  "sequence_id": 12,
  "contact": "61412345678",
  "status": "stopped",
  "stop_reason": "removed"
}

Kulandela i-sequence.finished ene-reason removed. Oxhumana naye ongasekho kule sequence okwamanje uphendula 404 enrolment_not_found.

Gcina i-sequence nge-DELETE /sequences/{id}. Bonke abasemuva kwayo bayayeka (i-sequence.finished ene-reason sequence_deleted ngalinye), kodwa umbiko uyahlala: i-GET /sequences?all=true isaluhlu.

{
  "success": true,
  "request_id": "s5del",
  "id": 12,
  "status": "archived",
  "stopped": 4
}

Bhalisa ngokuzenzakalelayo ngethegi

Esikhundleni sokubiza i-POST /sequences/{id}/enrolments kusuka ekhodini lakho lokuzibhalisa, nikeza i-sequence i-enrol_tag. Oxhumana nabo abathola leyo thegi kusukela manje bayabhaliswa yi-app2email, ngabe ngabe ngamunye kanye. I-"" iyayivala. Oxhumana nabo ababe nethegi ngaphambili abayibhalisiwe; bhalise kanye nge-{"tag": "new-customer"} uma nabo ubafuna.

curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/sequences/12 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enrol_tag": "new-customer"}'

Bese ufaka ithegi kuxhumana naye lapho esayina (scope contacts:manage). Ama-tags othumela ayabhala esikhundleni samathegi exhumana naye, ngakho thumela uhlu olugcwele:

curl -X PATCH https://api.app2email.com/v1/YOUR_NUMBER/contacts/61412345678 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Jane", "tags": ["new-customer"]}'

I-enrol_tag_since ku-sequence ikhombisa ukuthi ithegi libalwa kusukela nini. Oxhumana nabo bangabhaliswa futhi kusuka ku-dashboard noma yi-automation.

Phendula ezehlakalweni

Isibambi esincane esihlola isignesha, sizidlulele izehlakalo esesizibonile, bese sirekhoda ukuthi ubani oqedile nokuthi ubani oklikile. Setha i-WEBHOOK_SECRET ibe yinani le-whsec_... yewebhu yakho.

Node.js (Express)
drip-events.mjs
// Node.js 18 or newer.  npm install express   then   node drip-events.mjs
import crypto from "node:crypto";
import express from "express";

const { WEBHOOK_SECRET, PORT = 3000 } = process.env;
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]);
  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)));
}

const app = express();
app.post("/whatsapp/webhook", express.raw({ type: "application/json" }), (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);
  const d = event.data;
  if (event.type === "sequence.finished") {
    // result completed, or stopped with reason replied | opted_out | removed | failed | not_allowed | sequence_deleted
    console.log(`sequence ${d.sequence_id}: ${d.contact} ${d.result} ${d.reason ?? ""} after ${d.steps_sent}/${d.steps} steps`);
  } else if (event.type === "link.clicked" && d.sequence_id && d.first_click) {
    console.log(`sequence ${d.sequence_id} step ${d.step_id}: ${d.contact} opened ${d.url}`);
  } else if (event.type === "contact.opted_out") {
    console.log(`${d.number} opted out (${d.source}): mark it in your CRM too`);
  }
  done.add(event.id);
  res.sendStatus(200);
});
app.listen(PORT, () => console.log(`listening on http://localhost:${PORT}/whatsapp/webhook`));
Python (Flask)
drip_events.py
# Python 3.9 or newer.  pip install flask   then   flask --app drip_events run --port 3000
import hashlib, hmac, json, os, re, time
from flask import Flask, request

SECRET = os.environ["WEBHOOK_SECRET"]
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 "")
    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)

app = Flask(__name__)

@app.post("/whatsapp/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["data"]
    if event["type"] == "sequence.finished":
        # result completed, or stopped with reason replied | opted_out | removed | failed | not_allowed | sequence_deleted
        print(f"sequence {d['sequence_id']}: {d['contact']} {d['result']} {d.get('reason') or ''} after {d.get('steps_sent')}/{d.get('steps')} steps")
    elif event["type"] == "link.clicked" and d.get("sequence_id") and d.get("first_click"):
        print(f"sequence {d['sequence_id']} step {d['step_id']}: {d['contact']} opened {d['url']}")
    elif event["type"] == "contact.opted_out":
        print(f"{d['number']} opted out ({d['source']}): mark it in your CRM too")
    done.add(event["id"])
    return "", 200

Kubiza kangakanani

  • app2email: uhlelo olunye lwenyanga. Isinyathelo ngasinye esithunyiwe sibalwa njengomlayezo oyedwa wephulani, ngaphandle kokwengeza inani ngomlayezo ngamunye (amanani). Umkhawulo wenombolo wenyanga nawo usebenza kumasinyathelo.
  • Meta: ikhokhisa isifanekiso ngasinye esilethiwe ngqo kwindlela yokukhokha ku-WhatsApp Business Account yakho, ngokusho isigaba nelizwe lekhasimende. Ukukhangisa kuyisigaba esibiza kakhulu emazweni amaningi. Ikhasimende elaphendula ngokushesha lithola izinyathelo ezimbalwa, ngakho libiza kancane.

Linganisa ngalokhu nge-WhatsApp pricing calculator. Emva kwalokho, i-meta_pricing ku-GET /usage ibala imilayezo yenyanga yokukhokhisa ngesigaba sika-Meta ngenani elingokoqobo, ne-object pricing kwizehlakalo ze-message.status ikhombisa ukuthi i-Meta ibale kanjani umlayezo ngamunye.

Uhlu lokuhlola lokukhiqiza

Done

Qala ngokuvunywa, bese ubhalisa. Isifanekiso sawo wonke amanyathelo kumele sibe yi-APPROVED ulimi lwesinyathelo. Isinyathelo esingeke sithunyelwe sibonisa ok: false ene-error ku-history yokubhalisa, futhi ikhasimende lingayeka nge-reason failed. Qaphela i-template.status_changed: isifanekiso uMeta asimisa noma asikhubaze emuva kwalokho asikwazi ukuthunyelwa nakanjani.

Done

Abantu abavumile kuphela. Bhalisa amakhasimende anikeze imvume yokuthola ukukhangisa nge-WhatsApp. Oxhumana nabo abasohlwini Lokungashayi (Do Not Call) badlulwa ngesikhathi sokubhalisa, futhi ukuphuma ngesikhathi se-sequence kuyiyeka masinyane. Uma umthetho wokuvuma usebenza (PUT /settings/optin), izinyathelo ze-MARKETING ziya kubantu abanorekhodi lokuvuma kuphela; zirekhode nge-POST /optins.

Done

Gcina i-STOP emlenzeni. Yonke isifanekiso se-marketing sitshela ukuthi kuyenziwa kanjani ukuyeka. Izivimbelo eziningi nemibiko iyehlisa isilinganiso sakho sekhwalithi, futhi isilinganiso esiphansi singamisa isifanekiso futhi sehlise umkhawulo wakho wemilayezo. I-GET /health ikhombisa i-quality_rating.

Done

Gcina i-stop_on_reply ivulekile. Ikhasimende elibhala emuva lifuna impendulo, hhayi isinyathelo esilandelayo. Phendula kuInbox noma ku-bot yakho, ngaphakathi kwewindi lamahora angu-24 okwavulwa ngalo umlayezo wakhe.

Done

Hlola zonke izehlakalo. Hlola i-X-App2email-Signature phezu komzimba ongaguqulwanga ngemfihlo ye-whsec_... yewebhu, ngendlela engathathi isikhathi esihlukile, futhi wenqabe t edlule imizuzu emi-5. Ikhodi engenhla iyenza lokho.

Done

Hlukanisa ngesazisi sesehlakalo. Gcina i-id yayo yonke izehlakalo ezicutshunguliwe (futhi ku-header X-App2email-Delivery) okungenani izinsuku ezimbili: i-webhook engaphendulanga nge-2xx ithola isehlakalo esifanayo kamuva, ene-id efanayo. Ukuze ugcine amarekhodi akho, indawo yekhasimende ku-sequence yipheya sequence_id ne-contact; ngayinye imikhonto ingu-step_id, contact ne-clicks.

Done

Phinda ukubhalisa ngokuphephile. Izicelo ze-sequence azithathi Idempotency-Key. I-POST /sequences/{id}/enrolments iphephile ukuthunyelwa futhi: oxhumana nabo abasevele ku-sequence bayadlulwa futhi babalwe ku-already_in_it. Ungaphindi i-POST /sequences ngaphandle kokuhlola; buka i-GET /sequences kuqala.

Done

Hlonipha imikhawulo. Kufika kwoxhumana nabo abangu-5000 ngesicelo sokubhalisa ngasinye (400 sequence_too_many_contacts ngaphezu kwalokho), izinyathelo ezingu-20 nge-sequence ngayinye, namasequence angu-100 ngenombolo ngayinye. Yonke impendulo inezi-X-RateLimit-Limit, X-RateLimit-Remaining kanye ne-X-RateLimit-Reset; uma udlula umkhawulo uthola 429 rate_limited ne-Retry-After. Bona Imikhawulo.

Done

Okudingekayo kuphela. Ikhodi ebhalisa amakhasimende amasha idinga i-messages:send kuphela. Gcina ukhiye oseveni lakho, hhayi ekhasini lewebhu noma elogini.

Uma kungasebenzi

OkubonakalayoKunganiUkulungisa
403 sequences_not_enabledIpulani yenombolo ayifaki ama-drip sequenceAtholakala kumapulani e-Standard ne-Professional nakuvivinyo: shintsha ipulani ekhasini lokukhokha
403 sequence_personal_numberInombolo iyinombolo yomuntu siqu ye-WhatsApp exhunywe ngekhodi ye-QR, engakwazi ukuthumela izifanekisoSebenzisa inombolo ye-WhatsApp Business API
403 plan_not_allowed, service_not_liveAkukho pulani ye-API, noma isevisi imisiweKhetha ipulani; isevisi emisiwe iyaqala kabusha ngo "Go Live" ekhasini le-Settings
403 insufficient_scopeUkhiye awunayo imvume (umlayezo uyitshela)Sebenzisa ukhiye one-messages:send (ne-messages:read yemibiko)
403 sandbox_keyUkhiye we-sandbox awukwazi ukudala, ukushintsha noma ukusula ama-sequence noma ukubhalisa ngempelaSebenzisa ukhiye ojwayelekile; ngokhiye we-sandbox kuphela ukufunda nokubhalisa nge-dry_run kuyasebenza
403 not_in_instant_sandboxInombolo yedemo ayinawo ama-sequenceSebenzisa ukhiye wenombolo yakho exhunywe
400 invalid_sequenceI-sequence noma isinyathelo asisebenzi (i-template_name ayikho, ithuba lingaphezu kwezinsuku ezingu-90, izinyathelo ezingaphezu kwezingu-20 ...)Lungisa okushiwo umlayezo; i-error.details.problems ibala zonke izinkinga
409 sequence_limitInombolo inama-sequence angu-100Susa ezingasasetshenziswa
409 sequence_emptyI-sequence inganazinyatheloEngeza izinyathelo nge-PUT /sequences/{id} ngaphambi kokubhalisa
400 sequence_no_contactsAkukho muntu ongabhalisa: azikho izinombolo, oxhumana nabo, isegmenti noma ithegi elinoxhumana naboThumela numbers, contacts, i-segment_id noma i-tag enoxhumana nabo
400 sequence_too_many_contactsKukhona oxhumana nabo abangaphezu kuka-5000 esicelweni esisodwaThumela ngamaqembu amancane
404 sequence_not_foundAyikho le sequence kule nombolo, noma isusiweGET /sequences iyabala
404 enrolment_not_foundOxhumana naye akasekho kule sequence okwamanjeGET /sequences/{id}/enrolments?status=active ibala abasemuva kwayo
enrolled ingu-0, on_do_not_call_list noma already_in_it akunjaloOxhumana nabo baphume, noma sebevele kule sequenceAkukho okulungisekayo: ikhasimende alibhalisweli kabili, futhi akuboniswa ngaphandle kokuvuma
history ikhombisa ok: false, noma sequence.finished ene-reason failed noma not_allowedIsinyathelo asikwazanga ukuthunyelwa kulo xhumana naye, isibonelo isifanekiso esingavunyelwe, noma akukho rekhodi lokuvuma ngenkathi umthetho wokuvuma usebenzaFunda i-error ku-history; vumela noma lungisa isifanekiso, noma rekhoda ukuvuma
429 rate_limitedIzicelo eziningi kakhulu kulokhiyeLinda izikhathi Retry-After, bese uzama futhi
503 sequences_not_readyAma-drip sequence awatholakali okwamanjeZama futhi kamuva; uma kuqhubeka, xhumana ne-support@app2email.com nge-request_id

Yonke impendulo inesi-request_id. GET /requests/{id} ikhombisa okulogiwe ngayo, futhi ne-support@app2email.com ingayithola. Zonke ikhodi: Amaphutha.

Yisebenzise nge-AI agent

I-MCP server https://api.app2email.com/mcp/sequences inezicelo ezifanayo njengamathuluzi: list_sequences, get_sequence, create_sequence, update_sequence, delete_sequence, enrol_in_sequence, list_sequence_enrolments kanye ne-remove_from_sequence. I-agent ingase ke iphendule ngokuthi "uchungechunge lwesiphakamiso lulunga kanjani?" noma ngokuthi "khipha uJane kuwo, usuthengile kakade". Bona Vumela i-AI agent iphathe i-WhatsApp yakho nge-MCP kanye ne-MCP.

Ezinye izincwadi zokwenza

Zonke izincwadi zokwenza