odarriba

odarriba

Ravenx

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}},
    ]
  end
end

You can just tell Ravenx to dispatch it synchronously:

YourApp.Notification.NotifyUser.dispatch(user)

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}}
]

Showing Posts 1 to 7

odarriba

odarriba OP

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

https://medium.com/acutario/sending-notifications-in-elixir-with-ravenx-1f2502a1f272

belaustegui

belaustegui

Wonderful! :raised_hands:

agustif

agustif

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.

odarriba

odarriba OP

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 (GitHub - acutario/ravenx: Notification dispatch library for Elixir applications · GitHub) 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!

odarriba

odarriba OP

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!

belaustegui

belaustegui

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:

brightball

brightball

Looks really sharp!

— All posts loaded —

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews