---
title: Send Webhooks from your Message Queue with Svix Bridge
authors: ['owen']
date: 2023-07-25T12:00:00
tags: ['Product']
summary: How Svix Bridge can make it easy to send webhooks from message queues.
---

![Cover image](./cover.png)

For many of our customers, the webhooks they want to send start out as events flowing through internal message queues.
We built our new agent, **Bridge**, to make adapting those pre-existing messages into webhooks as painless as possible.

## Turning Your Events into Webhooks

Turning pre-existing messages into webhooks often means having to build something to pull messages off a queue, reshape
them if needed, and finally send out a request to kick-off delivery to your webhook subscribers.

Bridge simplifies integrating Svix Webhooks with your _existing event-driven architecture_,
by bundling up queue consumers, transformations, and Svix API client calls into a single process.

With a small amount of configuration, you can start consuming events, reshaping, and sending webhooks in minutes.
You tell it a queue to read from, how to optionally reshape the payload, and let Bridge take care of the rest.

Here's an example configuration, reading from RabbitMQ:

```yaml
senders:
  - name: 'send-from-rabbitmq-example'
    input:
      type: 'rabbitmq'
      uri: ${RABBITMQ_URI}
      queue_name: ${QUEUE_NAME}

    transformation: |
      function handler(input) {
        return {
          appId: input.key,
          message: {
            eventType: input.event_type,
            payload: input.data
          }
        };
      }

    output:
      type: 'svix'
      token: ${SVIX_TOKEN}
```

In this example, we're subscribing to messages from a queue, making the payload conform to the expected shape,
including the required fields:

- `appId`
- `message.eventType`
- `message.payload`

Svix's [Create Message][cmg] API expects a JSON body to be prepared in this certain way, so a JavaScript function
(similar to Svix's [Payload Transformations][transformations]) can be defined to reformat the message.
By using a JS transformation in Bridge, we remove the need to pre-process the data in yet another queue consumer
running elsewhere. Instead, reshaping of the data can be done inline.

Today, Bridge supports a short list of queue backends:

- GCP Pub/Sub
- RabbitMQ
- Redis
- SQS

Our new library, [Omniqueue][omniqueue-repo], was developed in tandem. Once adopted in Bridge, we'll be
able to add support for more backends by expanding capabilities on the omniqueue side.
Omniqueue should make it easier than ever to provide access to more queue backends.

For more on Omniqueue, check out [Omniqueue: A Queue Abstraction Layer for Rust][omniqueue-post]

## Wrapping up

Bridge can be a low-code option to conveniently start sending webhooks from the messages already
flowing through your organization.

If you've got events flowing through a message queue and want to publish them as webhooks, give Bridge a try!

- Grab the [Docker Image][docker-hub] from Docker Hub, or build Bridge yourself from source.
- Check out the [repo][bridge-repo] for details on how to build, configure, and otherwise get up and running.

Sending webhooks is one place where using a message queue makes good sense, but so is consuming webhooks.
Stay tuned for future post on how Bridge can help streamline a set of best practices for receiving and handling webhooks.

---

For more content like this, make sure to follow us on
[Twitter](https://twitter.com/SvixHQ), [Github](https://github.com/svix) or [RSS](https://www.svix.com/blog/rss/) for
the latest updates for the [Svix webhook service](https://www.svix.com), or join the discussion on
[our community Slack](https://www.svix.com/slack/).

[docker-hub]: https://registry.hub.docker.com/r/svix/svix-bridge
[bridge-repo]: https://github.com/svix/svix-webhooks/tree/main/bridge
[transformations]: https://docs.svix.com/transformations#using-transformations
[cmg]: https://api.us.svix.com/docs#tag/Message/operation/v1.message.create
[omniqueue-repo]: https://github.com/svix/omniqueue-rs
[omniqueue-post]: https://www.svix.com/blog/omniqueue/
