Lewati ke konten
Start free

Connect your external agent

Konten ini belum tersedia dalam bahasa Anda.

An external agent is anything outside Wabery that stays online and writes customer replies: n8n, Make, Zapier, your app, or your own AI runtime.

It receives a webhook, decides what to say, and sends the reply through Wabery:

Wabery webhook → your logic or AI → POST /v1/messages

In onboarding, choose My own backend, then pick your tool. You can change the tool later from the setup checklist.

Need Wabery to provide and host the chatbot instead? Use the hosted-agent guide.

  1. Create a public HTTPS endpoint in your workflow tool and paste it into Wabery. Saving it creates a signing secret, switches the project to external routing, and sends a message.received setup event.
  2. Confirm the endpoint returns a 2xx response for the setup event. It has payload.test: true and synthetic channel and conversation IDs, so acknowledge it without calling the Messages API.
  3. Create the reply-ready wab_live_ project key in onboarding. Keep it secret. The same key works in the shared sandbox and on connected WhatsApp channels.
  4. Join the shared WhatsApp sandbox and send a customer-style message.
  5. Reply by mapping payload.channel_id and payload.conversation_id from the incoming live event into this request:
POST https://api.wabery.com/v1/messages
Authorization: Bearer wab_live_...
Content-Type: application/json
{
"channel_id": "channel_...",
"conversation_id": "conv_...",
"text": "Your generated reply"
}

Wabery waits up to 10 seconds for your 2xx response. Respond first, then send the reply. Failed deliveries retry with growing delays for about two hours, and every retry keeps the same x-wabery-delivery-id header.

Follow the step-by-step n8n guide. It covers the Webhook and HTTP Request node settings, an importable workflow file, the sandbox test, going live, and troubleshooting.

The finished shape is Webhook → your logic / AI → HTTP Request.

  1. Start a scenario with Webhooks → Custom webhook, add a webhook, and copy its generated URL. Make documents this as an instant trigger in its current webhook guide.
  2. Paste that URL into Wabery. Choose Run once in Make before sending the Wabery test so Make discovers the event fields.
  3. Add a filter after the webhook so events where payload.test is true stop there. The setup event uses synthetic IDs and cannot be replied to.
  4. Put your routing, data lookup, or AI modules after the filter.
  5. Finish with HTTP v4 → Make a request. Select POST, use https://api.wabery.com/v1/messages, select application/json, and map the two IDs and reply text into the JSON body.
  6. Select API key authentication and create a keychain. The key is Bearer <your Wabery key> including the prefix, placement is header, and parameter name is Authorization. This follows Make’s current API key keychain and HTTP v4 documentation.

The finished shape is Custom webhook → your scenario → HTTP v4. Turn the scenario on after the sandbox test succeeds.

  1. Start a Zap with Webhooks by Zapier and choose Catch Hook. Zapier recommends Catch Hook for parsed POST payloads and generates a unique URL. See the current Zapier webhook trigger guide.
  2. Paste the Catch Hook URL into Wabery, send the Wabery test, then choose Test trigger in Zapier so the payload fields become mappable.
  3. Add a filter so events where payload.test is true stop, then add the actions that choose or generate the reply.
  4. Add Webhooks by Zapier → POST. Send JSON to https://api.wabery.com/v1/messages, map payload.channel_id, payload.conversation_id, and the reply text, and add Authorization: Bearer <your Wabery key>.
  5. Test the POST action, then publish the Zap before proving the loop in the Wabery sandbox.

The finished shape is Catch Hook → your Zap → POST action.

Expose a public HTTPS POST route that returns a 2xx response quickly. Read the raw request body before JSON parsing, verify X-Wabery-Signature with the project signing secret, and ignore duplicate delivery IDs. Then run your reply logic and call POST /v1/messages with a reply-ready project key.

This minimal Node.js 18+ server has no dependencies. It acknowledges the setup event, skips retries, and answers each message with a fixed reply. Replace the text line with your own logic.

import { createHmac, timingSafeEqual } from "node:crypto";
import { createServer } from "node:http";
const SECRET = process.env.WABERY_WEBHOOK_SECRET; // project signing secret
const API_KEY = process.env.WABERY_API_KEY; // wab_live_... reply key
const seen = new Set(); // use a database in production
function isSigned(rawBody, signature = "") {
const expected = `sha256=${createHmac("sha256", SECRET).update(rawBody).digest("hex")}`;
return (
signature.length === expected.length &&
timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
);
}
async function reply(payload) {
const text = `Thanks! You wrote: ${payload.text ?? "(no text)"}`; // your logic here
const res = await fetch("https://api.wabery.com/v1/messages", {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
channel_id: payload.channel_id,
conversation_id: payload.conversation_id,
text,
}),
});
if (!res.ok) console.error("Reply failed", res.status, await res.text());
}
createServer((req, res) => {
const chunks = [];
req.on("data", (chunk) => chunks.push(chunk));
req.on("end", () => {
const rawBody = Buffer.concat(chunks).toString("utf8");
if (!isSigned(rawBody, req.headers["x-wabery-signature"])) {
res.writeHead(401).end();
return;
}
res.writeHead(200).end(); // acknowledge first, then reply
const deliveryId = req.headers["x-wabery-delivery-id"];
if (deliveryId && seen.has(deliveryId)) return; // a retry
if (deliveryId) seen.add(deliveryId);
const { event, payload } = JSON.parse(rawBody);
if (event !== "message.received" || payload.test === true) return;
reply(payload).catch((error) => console.error(error));
});
}).listen(Number(process.env.PORT ?? 3000));

Run it behind HTTPS (for example, a reverse proxy or your host’s TLS), then paste its public URL into Wabery.

Use the webhook reference for PHP and Python signature checks, the typed SDK helper, complete event fields, delivery ordering, and media handling. Use the API client guide for TypeScript, PHP, and Python clients.

The finished shape is POST webhook → your handler → Messages API.

Do not switch to a real number until the onboarding checklist shows all three tasks complete: the webhook test passed, the reply key exists, and the sandbox conversation worked. That final task proves both directions: Wabery delivered the inbound event, and your platform returned a reply through the Messages API. When it passes, connect the client’s number under Channels.