Use Case

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.

1

Create a webhook

Create a Hooque webhook for Twilio/SendGrid events and copy the endpoint URL.

2

Point provider to Hooque

Configure SendGrid Event Webhook or Twilio callbacks to hit your hosted endpoint.

3

Consume from the queue

Stream via SSE (or pull via REST) and Ack/Nack each delivery.

FAQ

Communication webhooks FAQ

Questions about delivery receipts, bounce events, retries, and safe async processing.

Providers retry webhooks when your endpoint times out or returns a non-2xx. With Hooque, you respond fast at ingest and process asynchronously, so retries stop being coupled to your handler latency.
Bursts are buffered into a durable queue. Your processors can drain at a steady rate instead of trying to handle thousands of events per minute inline.
Yes. Use SSE streaming for low-latency processing, or REST pull if you prefer batch jobs.
No. Your providers call the hosted Hooque endpoint. Your processors consume via outbound requests to the queue (REST or SSE).
Ack when processing succeeds. Nack transient failures (rate limits, timeouts) to retry later, and reject permanently invalid payloads with a reason.
Yes. Create separate webhooks or consumers per source and event type so each pipeline has its own throughput, keys, and retry policy.

Still have questions?

Contact our support team

Start 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 free

No credit card required