CONNECT YOUR CODE TO SCHEDULED WEBHOOKS: FROM AUTOMATION RECIPES TO A PLAIN API
Connect your code to scheduled webhooks: from automation recipes to a plain API
The Schedule + Code + Webhooks pattern in tools like Zapier, Make, and n8n — and the API-native way to connect code, schedules, and webhook integrations: register a receiver, attach events, let a scheduler fire signed POSTs your code acts on. In any language.
Every now and then a search lands on the same intent from three directions at once: connect code, schedule, webhook. It’s one architecture question wearing a few hats — how does my code run on a schedule, connected through a webhook, without glue code I regret? There are two answers: the automation-recipe way, and the API-native way. This is both, and where each one is the right call.
The automation-recipe pattern: Schedule trigger → Code step → Webhooks action
In tools like Zapier, Make, and n8n, the classic recipe is:
Schedule trigger (e.g. "every day at 9am")
→ Code step (run some JavaScript/Python)
→ Webhooks action (POST the result to your endpoint)
It’s genuinely useful for glue: someone in ops prototypes it in an afternoon, and nobody writes a receiver. Know what you’re buying, though:
| Aspect | Automation-platform recipe | What it costs you |
|---|---|---|
| The tick | Polling-based schedule triggers (minutes at best on lower tiers) | Imprecision; no cron expressions, no minute-true timing |
| Your code | Runs in their sandbox with execution/memory limits | Long jobs, big payloads, private deps — no |
| The schedule | Lives in the Zap; edited by humans in the UI | Your code can’t create or change schedules; agents can’t either |
| Every run | Costs tasks | Real money at volume |
| Signing | Your endpoint trusts whoever has the Zap URL | No HMAC envelope of its own to verify |
Fine for a prototype or a low-cadence internal nudge. The moment the schedule is load-bearing — triggers payments, fans out to customers, wakes an agent — you want the schedule to be an API resource, not a canvas node.
The API-native pattern: schedule → signed webhook → your code
The portable version of the same architecture compresses into three roles:
┌──────────────────┐ signed POST with your event JSON ┌─────────────────────┐
cron + │ Recurrence Cloud │ ────────────────────────────────────────► │ your endpoint /code │
event → │ (the clock) │ X-Webhook-Signature: <hex HMAC> │ (the work) │
└──────────────────┘ └─────────────────────┘
- Your code exposes a POST endpoint. Any HTTP runtime works — Node, Python, Go, a Cloudflare Worker, a Vercel route handler. No SDK required; the receiver is “read raw body, verify HMAC, process, reply 2xx fast.”
- A schedule and event get attached to it. One API call creates the schedule (cron expression + timezone), the webhook receiver, and the event definition; more events attach to the same schedule. Create and manage schedules from your own code, on demand.
- The scheduler delivers on time, signed, and observable.
X-Webhook-Signature(HMAC-SHA256 over the raw body) proves authenticity, retries-with-backoff handle blips, and every attempt lands in the activity trail your monitoring reads.
// The entire integration surface on the receiver side:
app.post("/jobs/daily-rollup", async (c) => {
const raw = await c.req.raw.text();
if (!await verifyHmac(c.req.header("X-Webhook-Signature")!, raw, process.env.WEBHOOK_SECRET!))
return new Response("unauthorized", { status: 401 });
await queue.push(raw); // ack fast, work async
return Response.json({ ok: true });
});
And the scheduling side is one call:
curl -X POST https://api.recurrence.cloud/api/v1/schedules/with-webhook \
-H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \
-d '{
"schedule": { "name": "rollup", "cronExpr": "0 9 * * *", "timezone": "America/New_York" },
"webhook": { "url": "https://api.yourapp.dev/jobs/daily-rollup" },
"event": { "subject": "rollup-prod", "payload": { "window": "24h" } },
"appId": "$APP_ID"
}'
Where each integration style wins
Automation-recipe (Zapier/Make/n8n): one-off internal glue, non-developer ownership, tiny volumes, “no code” is the point.
API-native (scheduled webhooks): anything triggering business logic, per-customer schedules your product creates, scale-to-zero endpoints (edge and serverless receivers), agent-created schedules — the schedule is infrastructure your code, your ops, and your AI agents via MCP can all drive.
The two aren’t mutually exclusive: teams prototype with a Schedule→Code→Webhook Zap, then replace the recipe with one POST /schedules call and keep the receiver nearly unchanged. The receiver contract — verify, act, respond — is the same either way; the difference is who owns the middle of the wire and what it can prove about itself.
The whole integration then reads as its three nouns in order: code exposes the endpoint, schedule owns the clock, webhook carries the events between them — and code–schedule–webhook integrations built that way stay verifiable at every hop.
FAQ
How do I connect my code to a scheduled webhook?
Register an HTTPS endpoint of yours as a webhook receiver with a scheduler, attach a defined event (a subject and payload) to a cron schedule, and your code runs every time the scheduler POSTs the signed delivery. The receiver can be an Express route, a Next.js handler, a Cloudflare Worker, or any HTTP endpoint — three lines of framework code plus HMAC verification.
What is the Schedule + Code + Webhooks pattern in Zapier?
Zapier lets you chain a Schedule trigger (a recurring tick), a Code step (JavaScript or Python that runs your logic), and a Webhooks by Zapier action (POST to your endpoint) in one Zap. It works for glue, but the tick is polling-based, the code runs in a sandbox with runtime and memory limits, every run costs tasks, and the schedule itself isn't something your API can create or your agents can manage.
Can I schedule my own code without Zapier?
Yes — and for anything reliable or high-volume you should. The API-native version: your code exposes an HTTP endpoint, a scheduling platform like Recurrence Cloud fires a signed webhook POST at it on any cron expression with your event payload, and you create or change schedules from code with a single API call. No per-run pricing, no sandbox limits, no polling.
How do code–schedule–webhook integrations handle security?
Every scheduled delivery is signed. Recurrence Cloud sends X-Webhook-Signature, an HMAC-SHA256 digest of the raw request body which your code verifies against your webhook secret with a constant-time compare, rejecting anything unsigned with a 401. Secrets live in a secrets manager and rotate without redeploying.
What's the webhook's job in the integration — does it run my code or wait for it?
The webhook is the contract between the scheduler and your code: the scheduler owns when, the delivery carries what (your events, batched by subject), and the receiver does the work and returns fast. Long jobs should ack with 2xx and process asynchronously — that's also OWASP's advice for webhook endpoints.
Which languages and runtimes work as scheduled-webhook receivers?
Anything that speaks HTTP: Node, Python, Go, Java, Cloudflare Workers and other edge functions, Vercel route handlers, Deno Deploy. No SDK is required — the receiver is a POST handler verifying an HMAC header. Even MCP servers can be receivers so schedules can invoke your agent tools on time.