Telegram strategy for Ravenx


Some time ago, I discovered interesting library for notification dispatch for Elixir language: https://github.com/acutario/ravenx.

It can be very useful, if you want to send notifications via different channels, for example via Email and Slack (package supports both methods out of the box).

But for purposes of one of my pet project - I need Telegram channels messaging.

So, welcome: https://github.com/maratgaliev/ravenx_telegram

Installation

To install this package, you need to add ravenx_telegram to your list of dependencies in mix.exs:

def deps do
  [{:ravenx_telegram, "~> 0.1.1"}]
end

And second you need to add it to the list of Ravenx strategies in the config in order for it to work:

config :ravenx, :strategies, [
  telegram: RavenxTelegram
]

This module uses Nadia, so add into your app:

# You can get your token from @BotFather bot in Telegram.
config :nadia,
  token: "YOUR_BOT_TOKEN"

Send messages via Ravenx:

# You should create public channel in Telegram and add your bot to Admin users, when get public channel name from channel settings (or set it)   
iex> Ravenx.dispatch(:telegram, %{channel_id: "@ravenx_test", text: "Test message"}

That’s it, nothing special :)