# WhatsApp'ta teknisyen yolda mesajı ve müşteri yanıtları

> İş en_route durumuna geçtiğinde WhatsApp utility şablonu gönderin, kapı kodlarını ve erteleme isteklerini yanıt olarak alın, işe not düşüp teknisyene iletin.

Published 2026-11-27. Z-API Omni team.

Teknisyen yolda mesajı, saha teknisyeni rezerve edilmiş bir işe doğru yola çıktığında gönderilen, teknisyenin adını ve tahmini varış saatini (ETA) taşıyan bir utility şablonudur. İş kaydınız `en_route` durumuna geçtiğinde tetikleyin. Üç hızlı yanıt sunun: "Gate code / access info" (kapı kodu / giriş bilgisi), "Running late" (gecikeceğim) ve "Need to reschedule" (ertelemem gerekiyor). Her yanıtı `job_notes` tablosuna yazın ve atanmış teknisyene Telegram ya da onay vermiş bir WhatsApp numarası üzerinden iletin. Şablona kısa bir TTL verin, çünkü "yoldayım" bildirimi bir saat sonra işe yaramaz.

Aşağıdaki çalıştırılabilir çekirdek kendi iş tablonuzdur, çünkü hangi dispatch aracını kullanırsanız kullanın onu siz kontrol edersiniz. Bir Housecall Pro adaptörü, `job.on_my_way` webhook'unu aynı duruma eşler; doğrulanmamış kısımları işaretlenmiştir. Kargolar için kardeş kalıp [erteleme butonlu teslim edilemedi bildirimi](/academy/tr/articles/whatsapp-delivery-update-not-home-reschedule/) yazısında.

## Olay: iş en_route durumuna geçer

Dispatch uygulamanız teknisyenin ne zaman çıktığını zaten bilir. Tetikleyiciyi bu tek durum değişikliği yapın ve telefonu, onayı ve teknisyenin iletişim bilgisini sahibi olduğunuz satırlarda tutun:

```sql
CREATE TABLE jobs (
  id               text PRIMARY KEY,
  external_id      text UNIQUE,            -- the job id in Housecall Pro, if you use it
  customer_name    text NOT NULL,
  phone            text NOT NULL,          -- digits with country code
  whatsapp_opt_in  boolean NOT NULL DEFAULT false,
  time_zone        text NOT NULL DEFAULT 'UTC',
  scheduled_start  timestamptz NOT NULL,
  status           text NOT NULL DEFAULT 'scheduled',  -- scheduled, en_route, in_progress, done, canceled, reschedule_requested
  eta              timestamptz,
  eta_updates      int NOT NULL DEFAULT 0,
  tech_name        text NOT NULL,
  tech_telegram_chat_id bigint
);

CREATE TABLE job_notes (
  id          bigserial PRIMARY KEY,
  job_id      text NOT NULL REFERENCES jobs(id),
  kind        text NOT NULL,               -- access_info, running_late, reschedule, message
  body        text NOT NULL,
  sensitive   boolean NOT NULL DEFAULT false,
  source_wamid text UNIQUE,                -- the inbound WhatsApp message id, so a retry inserts nothing
  created_at  timestamptz NOT NULL DEFAULT now()
);
```

`scheduled` durumundan `en_route` durumuna koşullu bir update ile geçin ve yalnızca bir satır değiştiyse gönderin. Böylece aynı iş için tekrarlanan bir yola çıkış olayı hiçbir şeyi değiştirmez; tekilleştirmeniz budur. Tek istisna yeni bir ETA'dır; aşağıda "Bir şey başarısız olduğunda" bölümünde ele alınıyor.

### Kaynak olarak Housecall Pro

Housecall Pro'nun yardım merkezi, webhook olayları arasında `job.started`, `job.completed`, `job.canceled` ve `job.appointment.rescheduled` ile birlikte `job.on_my_way` olayını listeler ([How to Enable Webhooks, erişim tarihi 2026-11-27](https://help.housecallpro.com/en/articles/5683520-how-to-enable-webhooks)). Bunları My Apps > All Apps > Webhooks altında etkinleştirir, URL'yi girer ve olayları seçersiniz. Makale "kaydettikten sonra Housecall Pro bir imzalama secret'ı döndürür" diye ekler. Ayrıca "Webhooks yalnızca MAX planında kullanılabilir" der; [API genel bakışı](https://help.housecallpro.com/en/articles/8505035-api-overview) (erişim tarihi 2026-11-27) da API için aynısını söyler.

Adaptör üç kısmı bilinmeyen olarak ele alır, çünkü hiçbiri doğrulanamadı. İlki imza şemasıdır. docs.housecallpro.com adresindeki geliştirici dokümanları, okunabilir metin döndürmeyen tek sayfalık bir uygulama olarak açılıyor. [Webhooks sayfasının](https://docs.housecallpro.com/docs/housecall-public-api/46e9e1be07621-webhooks) bir arama özeti, zaman damgası ve payload üzerinde HMAC-SHA256 ile `Api-Timestamp` ve `Api-Signature` başlıklarını anlatıyor. Başka kaynaklar farklı bir başlıktan söz ediyor.

Payload biçimi ve yeniden deneme politikası da okunabilir biçimde belgelenmemiş. Adaptör `{ event, job: { id } }` biçimini varsayar ve gövdeden başka hiçbir şey kullanmaz. Doğrulanabilir bir iş notu endpoint'i bulunamadı, bu yüzden not sizin `job_notes` tablonuzda kalır.

Adaptör ilk teslimatta tüm başlıkları loglar; böylece gerçek şemayı okuyabilirsiniz. Doğrulama varsayılan olarak zorunludur. `HCP_ENFORCE_SIGNATURE=0` değerini yalnızca test işleriyle yapılan bir test aralığında ayarlayın.

## Mesaj: ETA içeren bir utility şablonu

Müşterinin rezerve ettiği bir ziyaret Meta'nın utility testine uyar. İçerik "tanıtım amaçlı olmayan" ve "kullanıcıya özgü veya kullanıcı tarafından talep edilmiş (siparişi, hesabı, hizmetleri veya işlemleriyle açıkça ilgili)" olmalıdır ([şablon kategorilendirme, erişim tarihi 2026-11-27](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/template-categorization)). Meta'nın sayfası saha teknisyenlerinden söz etmiyor, ama "hizmetler" rezerve edilmiş bir ziyareti kapsar. Tekliflerden uzak durun: aynı mesajdaki bir bakım planı satışı onu pazarlama yapar.

Hiçbir Template Library türü uymuyor. `DELIVERY_UPDATE` kargolar içindir, bu yüzden özel bir şablon yazın. Adlandırılmış parametreler teknisyen ile ETA'nın yer değiştirmesini önler. Değişkenleri gövdenin en başından ve en sonundan uzak tutun. [Şablon reddedilme nedenleri](/academy/tr/articles/whatsapp-template-rejected-common-reasons/) yazısında anlatıldığı gibi Meta'nın incelemesi bir parametreyle başlayan veya biten şablonu reddeder.

`message_send_ttl_seconds` değerini kısa tutun. Utility şablonlarının varsayılanı 30 gündür ve alan 30 ile 43.200 saniye arasını kabul eder. Meta "varsayılan veya özelleştirilmiş TTL içinde teslim edilemeyen mesajları düşürür" ([time-to-live, erişim tarihi 2026-11-27](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/time-to-live)). Aşağıdaki 1.800 saniye bizim tercihimiz. Meta bir değer önermiyor.

```bash
curl -X POST "https://graph.facebook.com/v26.0/$WABA_ID/message_templates" \
  -H "Authorization: Bearer $WA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "tech_en_route",
  "category": "UTILITY",
  "language": "en_US",
  "parameter_format": "NAMED",
  "message_send_ttl_seconds": 1800,
  "components": [
    {
      "type": "BODY",
      "text": "Hi {{customer_name}}, {{tech_name}} is on the way to your appointment and should arrive around {{eta}}. Reply below if anything changes.",
      "example": {
        "body_text_named_params": [
          { "param_name": "customer_name", "example": "Ana" },
          { "param_name": "tech_name", "example": "Marco" },
          { "param_name": "eta", "example": "2:40 PM" }
        ]
      }
    },
    {
      "type": "BUTTONS",
      "buttons": [
        { "type": "QUICK_REPLY", "text": "Gate code / access info" },
        { "type": "QUICK_REPLY", "text": "Running late" },
        { "type": "QUICK_REPLY", "text": "Need to reschedule" }
      ]
    }
  ]
}'
```

Şablonu yalnızca rezervasyon sırasında WhatsApp güncellemelerine onay vermiş müşterilere gönderin. Onay, [WhatsApp opt-in nasıl toplanır](/academy/tr/articles/whatsapp-opt-in-how-to-collect-consent/) yazısında anlatıldığı gibi işletmenizin adını içermelidir.

## Yanıt: dokunuşlar ve yazılan kapı kodları

Her hızlı yanıt gönderim sırasında `access:J-2291` gibi bir payload alır. Dokunuş `button.payload`, `button.text` ve şablonunuzun wamid değeri olan `context.id` ile birlikte `type: "button"` olarak gelir. Tam biçim ve kullanıcı adı uyarısı [Confirm ve Cancel butonlu sipariş onayı](/academy/tr/articles/whatsapp-order-confirmation-confirm-cancel-buttons/) yazısında. Önce `context.id` üzerinden eşleştirin.

Dokunuş 24 saatlik pencereyi açar, bu yüzden servis serbest metinle yanıt verebilir. "Gate code / access info" dokunuşuna şu yanıt gider: "Lütfen kapı kodunu veya giriş bilgilerini buraya yazın." Müşterinin sonraki mesajı, kod `text.body` içinde olacak şekilde `type: "text"` olarak gelir. Müşteri mesajınızı alıntılamadıkça `context.id` taşımaz, bu yüzden servis onu telefona göre, giriş bilgisi bekleyen işle eşleştirir.

## Geri yazma: bir iş notu ve teknisyene bildirim

Her yanıt `job_notes` içinde bir satır olur; satır gelen wamid ile anahtarlanır, böylece Meta'nın yeniden denemesi hiçbir şey eklemez. Sonra teknisyenin bunu varmadan önce görmesi gerekir. Housecall Pro teknisyenin uygulamasına mesaj gönderen bir çağrı belgelemiyor, bu yüzden kontrol ettiğiniz bir kanal kullanın.

Dahili bir uyarı için Telegram uygundur. Teknisyen botunuzu bir kez başlatır, bu size onun özel `chat_id` değerini verir ve Telegram'da 24 saatlik pencere yoktur. Bir sohbeti bir kullanıcıya bağlamak [Telegram deep linking](/academy/tr/articles/telegram-bot-deep-linking-start-parameter/) yazısında, uygulama hesapları için ise [Telegram sohbetini uygulama kullanıcınıza bağlama](/academy/tr/articles/telegram-bot-link-account-order-notifications/) yazısında ele alınıyor. Teknisyenin onay vermiş kendi numarasına bir WhatsApp mesajı da işe yarar. Pencere dışında bunun için ayrı bir utility şablonu gerekir.

Kapı kodlarını hassas veri olarak ele alın. Onları `sensitive = true` ile saklayın, yalnızca atanmış teknisyenin özel sohbetine gönderin ve asla bir gruba ya da dispatcher kanalına yansıtmayın. Kodu müşteriye de geri tekrarlamayın. İş kapandıktan sonra notu kendi saklama politikanıza göre silin veya maskeleyin.

"Need to reschedule" işi değiştirir, bu yüzden bir kişiye gider. Servis `reschedule_requested` durumunu ayarlar, teknisyene beklemesini söyler ve işi dispatch ekibine devreder. "Running late" yalnızca bir not ekler ve bildirim gönderir.

## Servisin tamamı

Bu Node 18+ dosyası `npm install express` ile çalışır. Uygulamanızdan durum değişikliklerini alır, Housecall Pro'nun `job.on_my_way` olayını kabul eder, şablonu gönderir, Meta'nın `X-Hub-Signature-256` imzasını doğrular ve notları yazar. Durum bellekte tutulur; onu yukarıdaki tablolara eşleyin.

```js
// tech-en-route.js. Node 18+. npm install express
const crypto = require("crypto");
const express = require("express");

const {
  WA_TOKEN, PHONE_NUMBER_ID, APP_SECRET, VERIFY_TOKEN,
  TELEGRAM_BOT_TOKEN, INTERNAL_TOKEN,
  HCP_SIGNING_SECRET = "", HCP_ENFORCE_SIGNATURE = "1", PORT = "3000",
} = process.env;

const GRAPH_URL = `https://graph.facebook.com/v26.0/${PHONE_NUMBER_ID}/messages`;
const TG_URL = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`;

const jobs = new Map();          // jobs table: id -> job
const byExternalId = new Map();  // Housecall Pro job id -> job id
const byWamid = new Map();       // template wamid -> job id
const jobNotes = [];             // job_notes table
const noteWamids = new Set();    // job_notes.source_wamid UNIQUE
const seenEvents = new Set();    // `${jobId}:${eventType}` from Housecall Pro
const seenMessages = new Set();  // Meta messages[].id
const optOuts = new Set();       // phones and BSUIDs that sent STOP
let hcpHeadersLogged = false;

const safeEqual = (a, b) => {
  const x = Buffer.from(a ?? ""), y = Buffer.from(b ?? "");
  return x.length === y.length && crypto.timingSafeEqual(x, y);
};
const handOff = (jobId, reason, detail) => console.log("needs_person", { jobId, reason, detail });

function formatEta(iso, timeZone) {
  return new Intl.DateTimeFormat("en-US", { hour: "numeric", minute: "2-digit", timeZone }).format(new Date(iso));
}

async function waSend(body) {
  const res = await fetch(GRAPH_URL, {
    method: "POST",
    headers: { Authorization: `Bearer ${WA_TOKEN}`, "Content-Type": "application/json" },
    body: JSON.stringify({ messaging_product: "whatsapp", ...body }),
  });
  const json = await res.json();
  if (!res.ok) throw new Error(`Graph ${res.status}: ${JSON.stringify(json.error ?? json)}`);
  return json.messages[0].id;
}
const waText = (to, text) => waSend({ to, type: "text", text: { body: text } });

async function pushToTech(job, text) {
  if (!job.techTelegramChatId) { handOff(job.id, "tech_not_linked", null); return false; } // never log the text: it may hold a gate code
  const res = await fetch(TG_URL, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ chat_id: job.techTelegramChatId, text }),
  });
  const json = await res.json();
  if (!json.ok) handOff(job.id, "tech_push_failed", json.description);
  return json.ok === true;
}

function addNote(job, kind, body, sourceWamid, sensitive = false) {
  if (sourceWamid && noteWamids.has(sourceWamid)) return false;
  if (sourceWamid) noteWamids.add(sourceWamid);
  jobNotes.push({ jobId: job.id, kind, body, sensitive, sourceWamid, createdAt: new Date().toISOString() });
  return true;
}

const canMessage = (job) => job.whatsappOptIn && !optOuts.has(job.phone) && !(job.userId && optOuts.has(job.userId));

async function sendEnRoute(job) {
  const p = (k, v) => ({ type: "text", parameter_name: k, text: String(v) });
  const qr = (index, payload) => ({ type: "button", sub_type: "quick_reply", index, parameters: [{ type: "payload", payload }] });
  const wamid = await waSend({
    to: job.phone, type: "template",
    template: {
      name: "tech_en_route", language: { code: "en_US" },
      components: [
        { type: "body", parameters: [
          p("customer_name", job.customerName), p("tech_name", job.techName), p("eta", formatEta(job.eta, job.timeZone)),
        ] },
        qr(0, `access:${job.id}`), qr(1, `late:${job.id}`), qr(2, `resched:${job.id}`),
      ],
    },
  });
  byWamid.set(wamid, job.id);
}

// UPDATE jobs SET status = 'en_route' ... WHERE id = $1 AND status = 'scheduled'
async function setEnRoute(job, etaIso) {
  if (job.status === "en_route") {
    if (!etaIso || etaIso === job.eta || job.etaUpdates >= 1) return "ignored"; // at most one ETA update
    job.etaUpdates += 1;
  } else if (job.status === "scheduled") {
    job.status = "en_route";
  } else {
    return "ignored"; // canceled, done or already being rescheduled
  }
  job.eta = etaIso ?? job.eta ?? job.scheduledStart;
  if (!canMessage(job)) return "no_opt_in";
  try {
    await sendEnRoute(job);
    return "sent";
  } catch (err) {
    handOff(job.id, "en_route_send_failed", err.message);
    return "send_failed";
  }
}

function findWaitingJob(msg) {
  const id = byWamid.get(msg.context?.id);
  if (id) return jobs.get(id);
  for (const job of jobs.values()) {
    if (job.status === "en_route" && (job.phone === msg.from || (job.userId && job.userId === msg.from_user_id))) return job;
  }
  return null;
}

async function onWhatsAppMessage(msg) {
  if (seenMessages.has(msg.id)) return;
  seenMessages.add(msg.id);
  const text = msg.type === "text" ? String(msg.text?.body ?? "").trim() : "";
  if (/^stop$/i.test(text)) {
    [msg.from, msg.from_user_id].filter(Boolean).forEach((v) => optOuts.add(v));
    if (msg.from) await waText(msg.from, "Done. You will not get more visit updates here.");
    return;
  }
  const job = findWaitingJob(msg);
  if (!job) return handOff(null, "unmatched_message", { id: msg.id, type: msg.type });
  if (msg.from_user_id) job.userId = msg.from_user_id;

  if (msg.type === "button") {
    const [verb] = String(msg.button?.payload ?? "").split(":");
    const label = String(msg.button?.text ?? "").toLowerCase();
    const action = ["access", "late", "resched"].includes(verb) ? verb
      : label.startsWith("gate") ? "access" : label.startsWith("running") ? "late"
      : label.includes("reschedule") ? "resched" : "";
    if (action === "access") {
      job.awaitingAccessInfo = true;
      return waText(job.phone, "Please type the gate code or access details here. Only your technician will see them.");
    }
    if (action === "late") {
      if (!addNote(job, "running_late", "Customer is running late", msg.id)) return;
      await pushToTech(job, `Job ${job.id}: the customer says they are running late.`);
      return waText(job.phone, `Thanks. We told ${job.techName}.`);
    }
    if (action === "resched") {
      if (!addNote(job, "reschedule", "Customer asked to reschedule", msg.id)) return;
      if (job.status === "en_route") job.status = "reschedule_requested";
      await pushToTech(job, `Job ${job.id}: the customer asked to reschedule. Hold until dispatch confirms.`);
      handOff(job.id, "reschedule_requested", null);
      return waText(job.phone, "Thanks. Our team will message you here with new times.");
    }
    return handOff(job.id, "unreadable_button", msg.button);
  }

  if (msg.type !== "text") return handOff(job.id, "unsupported_type", msg.type);
  if (job.awaitingAccessInfo) {
    job.awaitingAccessInfo = false;
    if (!addNote(job, "access_info", text, msg.id, true)) return;
    const delivered = await pushToTech(job, `Job ${job.id} access info from the customer: ${text}`); // private chat only
    return waText(job.phone, delivered ? `Thanks. ${job.techName} has it.` : "Thanks. We saved it for your technician.");
  }
  if (!addNote(job, "message", text, msg.id)) return;
  await pushToTech(job, `Job ${job.id}, customer message: ${text}`);
}

// TODO:test: Housecall Pro signature scheme. A search snippet of its docs describes Api-Timestamp and
// Api-Signature, HMAC-SHA256 over the timestamp and the payload. The joining format and the hex encoding are guesses.
function verifyHcp(req) {
  const ts = req.get("api-timestamp"), given = req.get("api-signature");
  if (!HCP_SIGNING_SECRET || !ts || !given) return false;
  return [Buffer.from(`${ts}.`), Buffer.from(ts)].some((prefix) => {
    const hex = crypto.createHmac("sha256", HCP_SIGNING_SECRET).update(Buffer.concat([prefix, req.body])).digest("hex");
    return safeEqual(hex, given);
  });
}

const app = express();
const internal = (req, res, next) =>
  safeEqual(req.get("authorization"), `Bearer ${INTERNAL_TOKEN}`) ? next() : res.sendStatus(401);

// Your app upserts jobs here, or you read them from the jobs table directly.
app.post("/internal/jobs", express.json(), internal, (req, res) => {
  const j = req.body ?? {};
  if (!j.id || !j.phone || !j.scheduledStart || !j.techName) return res.sendStatus(400);
  const job = Object.assign(jobs.get(j.id) ?? { status: "scheduled", etaUpdates: 0, eta: null }, {
    id: j.id, externalId: j.externalId ?? null, customerName: j.customerName ?? "there",
    phone: String(j.phone).replace(/\D/g, ""), whatsappOptIn: j.whatsappOptIn === true,
    timeZone: j.timeZone ?? "UTC", scheduledStart: j.scheduledStart,
    techName: j.techName, techTelegramChatId: j.techTelegramChatId ?? null,
  });
  jobs.set(job.id, job);
  if (job.externalId) byExternalId.set(String(job.externalId), job.id);
  res.sendStatus(204);
});

// Your dispatch app posts { status: "en_route", eta: ISO string } when the technician leaves.
app.post("/internal/jobs/:id/status", express.json(), internal, async (req, res) => {
  const job = jobs.get(req.params.id);
  if (!job) return res.sendStatus(404);
  const { status, eta } = req.body ?? {};
  if (status === "en_route") return res.json({ result: await setEnRoute(job, eta) });
  if (["in_progress", "done", "canceled"].includes(status)) {
    job.status = status;
    job.awaitingAccessInfo = false;
    return res.json({ result: "updated" });
  }
  res.sendStatus(400);
});

app.post("/hcp/webhook", express.raw({ type: "*/*" }), async (req, res) => {
  if (!hcpHeadersLogged) {
    hcpHeadersLogged = true;
    console.log("hcp_first_delivery_headers", req.headers); // read the real signature scheme here
  }
  const verified = verifyHcp(req);
  if (!verified && HCP_ENFORCE_SIGNATURE === "1") return res.sendStatus(401);
  if (!verified) console.warn("hcp_signature_unverified");
  res.sendStatus(200);

  let body;
  try { body = JSON.parse(req.body.toString("utf8")); } catch { return; }
  // TODO:test: payload shape. Assumed { event, job: { id } }. Only the id is used.
  const jobId = byExternalId.get(String(body.job?.id ?? ""));
  const job = jobId && jobs.get(jobId);
  if (!job || !body.event) return;
  const key = `${job.id}:${body.event}`;
  if (seenEvents.has(key)) return;
  seenEvents.add(key);
  if (body.event === "job.on_my_way") return void (await setEnRoute(job, null));
  if (body.event === "job.started") job.status = "in_progress";
  if (body.event === "job.canceled") job.status = "canceled";
  if (body.event === "job.started" || body.event === "job.canceled") job.awaitingAccessInfo = false;
});

app.get("/whatsapp/webhook", (req, res) => {
  const ok = req.query["hub.mode"] === "subscribe" && req.query["hub.verify_token"] === VERIFY_TOKEN;
  return ok ? res.send(req.query["hub.challenge"]) : res.sendStatus(403);
});

app.post("/whatsapp/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const expected = "sha256=" + crypto.createHmac("sha256", APP_SECRET).update(req.body).digest("hex");
  if (!safeEqual(expected, req.get("x-hub-signature-256"))) return res.sendStatus(401);
  res.sendStatus(200);
  const body = JSON.parse(req.body.toString("utf8"));
  for (const entry of body.entry ?? []) {
    for (const change of entry.changes ?? []) {
      for (const msg of change.value?.messages ?? []) {
        onWhatsAppMessage(msg).catch((err) => handOff(null, "reply_failed", err.message));
      }
    }
  }
});

app.listen(Number(PORT), () => console.log(`listening on ${PORT}`));
```

Housecall Pro işlerinde ETA `scheduled_start` değerine geri düşer, çünkü olayın ETA alanları bilinmiyor. Housecall Pro'nun not endpoint'i dokümanlarında doğrulandığında geri yazmayı `addNote` sonrasına ekleyin. O zamana kadar notlar sizin tablonuzda yaşar ve dispatch ekibi önemli olanı kopyalar. Yeniden rezerve edilen bir ziyaret yeni bir iş ID'si ya da `scheduled` durumuna sıfırlama gerektirir. Dokunuş olmadan yazılan bir kod düz mesaj olarak saklanır, bu yüzden incelemede onu hassas olarak işaretleyin.

## Bir şey başarısız olduğunda

Müşteri hiç yanıt vermezse hiçbir şey değişmez. Teknisyen gelir ve `job.started` giriş bilgisi beklemesini temizler. Telefon 30 dakika kapalı kalırsa TTL mesajı düşürür, böylece bayat bir bildirim hiç ulaşmaz.

Teknisyen gecikirse ETA'yı yeniden hesaplayın ve aynı şablonu bir kez daha gönderin. Servis iş başına bir güncellemeye izin verir ve gerisini yok sayar. Ayrı bir "hâlâ yoldayım" şablonuna gerek yoktur.

`scheduled` durumundan `en_route` durumuna koşullu geçiş, Housecall Pro için iş ID'si artı olay türü anahtarı ve notlardaki benzersiz `source_wamid` yinelemeleri emer. STOP yanıtı, telefonu ve `from_user_id` değerini her gönderimin kontrol ettiği bir opt-out listesine ekler.

Başarısız bir Graph çağrısı yeniden deneme döngüsüne değil bir kişiye gider, çünkü geç gelen bir "yoldayım" kimsenin işine yaramaz. Başarısız bir Telegram bildirimi de bir kişiye gider, çünkü teknisyen kilitli bir kapıya doğru yürüyor olabilir. Housecall Pro'nun yeniden deneme politikası okunabilir biçimde belgelenmemiş, bu yüzden ilk teslimatlarda tekrarları izleyin.

## Z-API Omni'nin yeri

Meta'nın resmi API'sinde Omni, `tech_en_route` şablonunu `Bearer` Secret Key ile `POST https://api.omni.z-api.io/v1/channels/{channelId}/messages` üzerinden gönderir ve şablon oluşturma `message_send_ttl_seconds` kabul eder. Yazılan bir kapı kodu gibi serbest metin yanıtlar `contents[0].type: "TEXT"` ile `MESSAGE_RECEIVED` olarak gelir. Dokümanlar bir hızlı yanıt dokunuşunun gelen biçimini henüz göstermiyor. Belgelenmiş bir saha hizmeti entegrasyonu yok, bu yüzden köprü yukarıdaki servis olarak kalır.

Teknisyen bildirimi aynı abonelikteki bir Telegram kanalında çalışabilir; abonelik WhatsApp, Messenger ve Instagram'ı da kapsar. Fiyat 1 ila 10 numara için numara başına ayda US$29'dur ve kademeli olarak 100'ün üzerinde US$20'ye iner. Webhook'lar limit olmadan dahildir ve resmi bağlantıda Meta'nın ücretleri olduğu gibi yansıtılır.

<!-- TODO:test Omni snippet: send tech_en_route on a META_WHATSAPP channel; whether named body params need parameter_name; the inbound JSON of a quick-reply tap -->
```bash
curl -X POST "https://api.omni.z-api.io/v1/channels/$CHANNEL_ID/messages" \
  -H "Authorization: Bearer $OMNI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recipient":{"identifier":"5511999999999"},"content":{"type":"TEMPLATE","attachments":[{"template":{"name":"tech_en_route","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","parameters":[{"type":"text","text":"Ana"},{"type":"text","text":"Marco"},{"type":"text","text":"2:40 PM"}]}]}}]}}'
```

[Dokümantasyonu görüntüleyin](https://developer.omni.z-api.io/en)

*Z-API Omni ekibi*
