Developer use case

WhatsApp follow-up after a call

When a call ends with an outcome you choose, such as interested or call me back, the customer gets your approved WhatsApp template within seconds.

All use cases

Before you start

  • A live key with messages:send.
  • An approved WhatsApp template, and a WhatsApp connection on Integrations.
  • API access is on Growth and above. Without it every request answers 402, and the key works again once the plan includes it.

How it works

When a call ends with an outcome you choose, such as interested or call me back, the customer gets your approved WhatsApp template within seconds.

  • Permission messages:send
  • Event call.completed
  • Sends billed messages
  1. Subscribe your webhook to finished calls. call.completed

  2. In the webhook, look at the call's disposition and pick the calls to follow up, for example interested and callback.

  3. Send the approved template to the call's contact. Each message is billed, and an Idempotency-Key made from the call id is required, so a retried delivery never sends twice. A person on Do-Not-Call, without consent, or in the quiet hours is not messaged. POST /api/v1/messages/whatsapp

  4. No code? On Workflows, make one with the Call Ends trigger and a Send WhatsApp step instead. Use one or the other, not both, or the customer gets two messages.

Your webhook (Node)
// Every delivery is signed: check it before you trust the body.
const crypto = require("crypto");
function signed(rawBody, header, secret) {
  const want = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  return header && crypto.timingSafeEqual(Buffer.from(header), Buffer.from(want));
}

const FOLLOW_UP = ["interested", "callback"];      // the dispositions to follow up

app.post("/aicallstudio", express.raw({ type: "*/*" }), async (req, res) => {
  if (!signed(req.body, req.get("X-Aicallstudio-Signature"), process.env.WEBHOOK_SECRET)) return res.sendStatus(401);
  const { event, data } = JSON.parse(req.body);
  if (event === "call.completed" && FOLLOW_UP.includes(data.call.disposition)) {
    await fetch("https://aicallstudio.com/api/v1/messages/whatsapp", {   // billed: one message
      method: "POST",
      headers: {
        "Authorization": "Bearer " + process.env.AICALLSTUDIO_KEY,
        "Content-Type": "application/json",
        "Idempotency-Key": "after-call-" + data.call.id,
      },
      body: JSON.stringify({
        contact_id: data.call.contact_id,
        template: "after_call_follow_up",          // your approved template's name
        values: { "1": data.call.disposition_label },
      }),
    });
  }
  res.sendStatus(200);
});

Why a template and not a free-text message?

Because the 24-hour window may be closed: only an approved template can start a conversation, so the API sends only templates. A customer who replies opens the window, and your team answers in the WhatsApp inbox.

Costs and what to watch

  • Each message is billed. A customer on Do-Not-Call, without consent, or in the quiet hours is not messaged, and the request says so.

Put AI Call Studio on your phone lines.

Book a 30-minute walkthrough, or call us right now: +91 922 222 1378