Ravenx - Notification dispatcher


Hex: https://hex.pm/packages/ravenx
GitHub: https://github.com/acutario/ravenx

Ravenx is a notification dispatcher that allows to simplify the sending of notifications to external services, even if you need to send them using multiple providers.

The library has two main methods: the dispatch that returns the final state of the process and dispatch_async which just returns the reference of the %Task{} without waiting the response.

Each notification is defined by three thinhs: the strategy (or service) to use, the payload map (which contains the data used to build the notification) and the options map, which include configuration for the service provider, or similar.

In case you need to notify something using multiple methods (or strategies), you can create a Notification module that specify each notification sent.

Example of simple notification

You can just send a notification synchronously:

{:ok, response} = Ravenx.dispatch(:slack, %{title: "Hello world!", body: "Science is cool!"})

Or asynchronously:

{:ok, %Task{}} = Ravenx.dispatch_async(:slack, %{title: "Hello world!", body: "Science is cool!"})

Example of complex notification

Given this example notification module:

defmodule YourApp.Notification.NotifyUser do
  use Ravenx.Notification

  def get_notifications_config(user) do
    # In this function you can define which strategies use for your user (or
    # whatever you want to pass as argument) and return something like:

      slack: {:slack, %{title: "Important notification!", body: "Wait..."}, %{channel: user.slack_username}},
      email_user: {:email, %{subject: "Important notification!", html_body: "<h1>Wait...</h1>", to: user.email_address}},
      email_company: {:email, %{subject: "Important notification about an user!", html_body: "<h1>Wait...</h1>", to: user.company.email_address}},
      other_notification: {:invalid_strategy, %{text: "Important notification!"}, %{option1: value2}},

You can just tell Ravenx to dispatch it synchronously:


And it will spawn the different processes and return the response for each in just one call:

  slack: {:ok, ...},
  email_user: {:ok, ...},
  email_company: {:ok, ...},
  other_notification: {:error, {:unknown_strategy, :invalid_strategy}}

Just published a blog post about how to use Ravenx and why we built this library:


Wonderful! :raised_hands:

It looks great, Guys, do you think ravenx could fit well for connecting with Zapier?

At cercle crm we want to send notifications via zapier, and I thought about this as a good way to leave the door open to new integrations down the road.


It should not be complicated to integrate it with any external services.

The only thing you need to do is to create a custom strategy (https://github.com/acutario/ravenx#custom-strategies) to communicate with the service.

If you decide to do it, please feel free to create an auxiliary library or put a PR, so others can make use of it!

After some inactive months, we have just released version 2.0.0 of Ravenx.

The major changes are:

  • Simpler supervision tree
  • Code formatter applied to the src
  • Strategies now are in separate packages (except the dummy one)
  • Minor fixes

Special mention to the fact that strategies now are in different packages, avoiding additional dependencies for strategies that you are not going to use (like Bamboo).

How to upgrade

Just upgrade version, and add the packages of needed strategies. Then add the strategies to the application configuration as indicated in the README. And you are good to go!


Been using Ravenx by 6 months (more or less) in production delivering websocket and email notifications without any problem.
Can’t wait to update to the next release! :bow:


Looks really sharp!

1 Like