Queue Twilio & SendGrid webhooks
Delivery receipts and bounce events arrive fast-and retry when you do not respond.
Hooque decouples receipt from processing so you can handle campaign-scale volume safely.
The Challenge
Communication events are high-volume and time-sensitive — your webhook handler cannot be fragile. Without building retry logic, Twilio, SendGrid, and Mailgun delivery events fail noisily.
SMS receipts and email events arrive with tight timeout windows.
Twilio retries aggressively — slow handlers create duplicates.
High-volume campaigns generate thousands of events per minute.
How Hooque Solves It
Capture delivery events instantly, then stream them to your processors in real time.
Provider
Twilio / SendGrid
receipts - bounces - inbound
Buffer
Hooque
SSE streaming or REST pull
Consume
Your processors
Ack/Nack control
- Decouple receipt from processing so providers stop retrying immediately.
- Stream events over SSE for real-time handling (or pull for batch jobs).
- Handle campaign-scale volume with explicit Ack/Nack retry control.
Before & After
Keep the webhook path simple. Stream delivery events to your workers and control retries.
Without Hooque
Inline processing under tight timeouts
// Twilio/SendGrid webhook verification + processing inline
import express from "express";
const app = express();
app.use(express.json());
// Public webhook endpoint: where should we host it so providers can always reach it?
app.post("/comms/webhook", async (req, res) => {
const signature = req.get("x-twilio-signature") || req.get("x-twilio-email-event-webhook-signature");
// This signature check is often forgotten in rushed webhook handlers.
if (!verifyCommsSignature(req.rawBody, signature, process.env.COMMS_WEBHOOK_SECRET)) {
return res.status(401).send("invalid signature");
}
try {
// Hope we do not timeout while processing inline.
await process_communication_payload(req.body); // delivered, bounce, inbound
res.sendStatus(200);
} catch (err) {
// Do we need to send an alert here?
// How do we know which payload failed and how to debug it later?
res.sendStatus(500);
}
}); With Hooque
SSE stream consumer with Ack/Nack URLs
// Stream communication events from Hooque over SSE
const HOOQUE_URL = process.env.HOOQUE_URL; // e.g. https://app.hooque.io/queues/cons_comms_events
const TOKEN = process.env.HOOQUE_TOKEN;
const headers = { Authorization: `Bearer ${TOKEN}` };
// Signature verification is handled by Hooque before messages enter this stream.
const streamResp = await fetch(HOOQUE_URL + "/stream", { headers });
for await (const line of readSseLines(streamResp.body)) {
if (!line.startsWith("data:")) continue;
const event = JSON.parse(line.slice(5)); // { payload, meta }
const payload = event.payload;
const meta = event.meta;
try {
await process_communication_payload(payload); // delivered, bounce, inbound
await fetch(meta.ackUrl, { method: "POST", headers });
} catch (err) {
// Failed message can be inspected in Hooque, and we receive an alert about it.
await fetch(meta.nackUrl, {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({ reason: String(err) }),
});
}
} Key Benefits
Build a delivery-event pipeline you can trust under load.
Decouple receipt from processing
Respond fast to providers while your workers do the real work safely.
Real-time SSE streaming
Subscribe once and process events as they arrive — great for receipts and inbound messages.
Campaign-scale volume
Buffer bursts and handle duplicates and retries with Ack/Nack/Reject controls.
How It Works
Route comms webhooks into a queue, then stream them to your processors.
Create a webhook
Create a Hooque webhook for Twilio/SendGrid events and copy the endpoint URL.
Point provider to Hooque
Configure SendGrid Event Webhook or Twilio callbacks to hit your hosted endpoint.
Consume from the queue
Stream via SSE (or pull via REST) and Ack/Nack each delivery.
Related guides
Deeper dives on the production mechanics behind this use case.
Webhook API
Delivery lifecycle, timeouts, and safe processing patterns.
Read the guide
Retries and backoff
Idempotency and duplicate-proof retry handling.
Read the guide
Webhook security
Signatures, replay protection, and secret rotation.
Read the guide
Debugging playbook
Step-by-step triage for missing webhooks, signature failures, and duplicates.
Read the guide
Communication webhooks FAQ
Questions about delivery receipts, bounce events, retries, and safe async processing.
Still have questions?
Contact our support teamStart Processing Twilio & SendGrid Webhooks in 2 Minutes
Capture every delivery event, then process them reliably in the background (or stream in real time).
Start for freeNo credit card required