The project is in a healthy, maintained state
Simple and easy
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.18
 Project Readme

TelegramSimpleMessenger

It's a simple gem to send messages through Telegram to a user or a group/channel.

What do you need?

To use it, you need and Telegram API KEY (a bot key) and a Chat ID.

API KEY

The API KEY you can get building a new bot through @BotFather. Just send a Telegram message to @BotFather and follows the instructions. An API KEY looks like this: 5490951233:AAFZH99VRQuIOH-qweL1fwATf3kna2eBQSE.

CHAT ID

Use another Telegram Bot @RawDataBot to find your own Chat ID or a group/channel Chat ID.

Installation

Add to your Gemfile

gem "telegram_simple_messenger", github: "shayani/telegram_simple_messenger"

Then run

bundle install

Configuration

Create a initializer file to set the default API KEY and CHAT ID

# config/initializers/telegram_simple_messenger.rb

TelegramSimpleMessenger.default_api_key=MY_API_KEY
TelegramSimpleMessenger.default_chat_id=MY_CHAT_ID

Usage

Sending a message using the default API KEY and CHAT ID

Simple call the service:

TelegramSimpleMessenger.send_message("Hello world!")

Overwriting the API KEY and/or CHAT ID

You can overwrite the default API KEY and CHAT ID passing them as arguments:

TelegramSimpleMessenger.send_message("Hello world!", ANOTHER_API_KEY, ANOTHER_CHAT_ID)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/telegram_simple_messenger.

License

The gem is available as open source under the terms of the MIT License.