AI & Agents

How to Process Fastio Webhooks with RabbitMQ

Processing Fastio webhooks with RabbitMQ lets you handle file events like uploads and modifications reliably. Direct HTTP responses risk timeouts during heavy loads, but queuing events with RabbitMQ decouples reception from processing. This setup scales for agentic teams tracking workspace activity in real time.

Fastio Editorial Team 12 min read
Queue incoming Fastio events for resilient handling

What Are Fastio Webhooks?

Fastio webhooks send HTTP POST requests to your endpoint when events occur in workspaces or shares. Events include file uploads (workspace_storage_file_added), deletions, comments, membership changes, and AI activity.

Each webhook payload is JSON with fields like event_id, event (e.g., workspace_storage_file_added), created timestamp, object_id (file node ID), and context IDs for org, workspace, or share.

Configure webhooks in the Fastio dashboard for a workspace or organization. Provide your URL and optional secret for signature verification. Fastio retries failed deliveries.

Event log showing file upload webhook trigger

Why Use RabbitMQ for Webhook Processing?

Webhook receivers must respond in seconds, or Fastio stops retrying. Processing tasks like file analysis or notifications can take longer.

RabbitMQ acts as a message broker. The receiver acknowledges the webhook quickly, publishes the event to a queue, and separate consumers handle work asynchronously.

Benefits include retry logic with dead letter queues, multiple consumers for scaling, and durability across restarts.

Fastio features

Ready for Reactive Workflows?

Fastio webhooks + RabbitMQ power agentic file processing. Start with 50GB free storage, 5,000 credits/month, no credit card.

Set Up RabbitMQ Locally

Start with Docker for development.

Create docker-compose.yml:

version: '3.8'
services:
  rabbitmq:
    image: rabbitmq:4-management
    ports:
      - "5672:5672"
      - "15672:15672"
    environment:
      RABBITMQ_DEFAULT_USER: guest
      RABBITMQ_DEFAULT_PASS: guest

Run docker compose up. Access management UI at http://localhost:15672.

Declare a queue named fastio-events via UI or API.

RabbitMQ management dashboard with queues

Build the Webhook Receiver in Node.js

Use Express and amqplib.

Install dependencies:

npm init -y
npm i express amqp-connection-manager body-parser crypto

Server code (server.js):

const express = require('express');
const bodyParser = require('body-parser');
const crypto = require('crypto');
const amqp = require('amqp-connection-manager');

const app = express();
app.use(bodyParser.raw({ type: 'application/json' }));

const RABBITMQ_URL = 'amqp://localhost:5672';
const WEBHOOK_SECRET = 'your-fastio-webhook-secret'; // From dashboard
const QUEUE = 'fastio-events';

const connection = amqp.connect([RABBITMQ_URL]);
const channelWrapper = connection.createChannel({
  json: true,
  setup: channel => channel.assertQueue(QUEUE, { durable: true })
});

app.post('/webhook', (req, res) => {
  const signature = req.headers['x-fastio-signature'];
  const body = req.body.toString();

const expectedSig = 'sha256=' + crypto.createHmac('sha256', WEBHOOK_SECRET)
    .update(body).digest('hex');

if (signature !== expectedSig) {
    return res.status(401).send('Invalid signature');
  }

channelWrapper.sendToQueue(QUEUE, JSON.parse(body), { persistent: true })
    .then(() => res.status(200).send('OK'))
    .catch(err => res.status(500).send('Queue error'));
});

app.listen(3000, () => console.log('Webhook receiver on port 3000'));

Run node server.js. Configure this URL (ngrok for public) in Fastio dashboard.

Consume and Process Queue Messages

Create a consumer script (consumer.js):

const amqp = require('amqp-connection-manager');

const connection = amqp.connect(['amqp://localhost:5672']);
const channelWrapper = connection.createChannel({
  json: true,
  setup: channel => channel.assertQueue('fastio-events', { durable: true })
    .then(() => channel.consume('fastio-events', msg => {
      const event = JSON.parse(msg.content.toString());
      console.log('Processing event:', event.event);

if (event.event === 'workspace_storage_file_added') {
        // Trigger file processing, e.g., AI analysis
        console.log('New file:', event.filename, event.object_id);
      }

channelWrapper.ack(msg);
    }, { noAck: false }));
});

Run node consumer.js. Scale by running multiple instances.

Add Retries and Dead Letter Exchanges

Configure DLQ for failed messages.

In management UI, create exchange dlx (type direct), queue fastio-events-dlq bound to dlx with routing key failed.

Update channel setup:

channel.assertQueue(QUEUE, {
  durable: true,
  arguments: {
    'x-dead-letter-exchange': 'dlx',
    'x-dead-letter-routing-key': 'failed',
    'x-message-ttl': 60000 // Retry after 1 min
  }
});

Bind retry queue to exchange with TTL for exponential backoff.

Test and Deploy

Simulate webhook:

curl -X POST http://localhost:3000/webhook \
  -H "X-Fastio-Signature: sha256=..." \
  -H "Content-Type: application/json" \
  -d '{"event":"workspace_storage_file_added","object_id":"node123","filename":"test.pdf"}'

Check queue and consumer logs.

Deploy to cloud: Use CloudAMQP or AWS MQ for managed RabbitMQ. Expose receiver via ngrok or Vercel.

Frequently Asked Questions

How do I queue webhooks in RabbitMQ?

Set up a webhook endpoint to verify the signature, parse the JSON payload, and publish to a durable queue using amqplib or Pika. Consumers subscribe to the queue for async processing.

Why use a message broker for API events?

Brokers like RabbitMQ provide durability, retries, load balancing across consumers, and decoupling between receiving and processing for high reliability.

What events does Fastio send via webhooks?

Events cover storage changes (file added, deleted), comments, members, AI chats, workflow tasks, and more. Full list in Fastio events documentation.

How to verify Fastio webhook signatures?

Use the secret from dashboard to compute HMAC-SHA256 of raw body. Compare to X-Fastio-Signature header.

Can I use RabbitMQ Cloud?

Yes, services like CloudAMQP integrate easily. Update connection URL in code.

Related Resources

Fastio features

Ready for Reactive Workflows?

Fastio webhooks + RabbitMQ power agentic file processing. Start with 50GB free storage, 5,000 credits/month, no credit card.