Project

flowerpot

0.0
No commit activity in last 3 years
No release in over 3 years
Flowerpot is a wrapper for various messaging channels. Currently Telegram, CM Telecom and Twilio are supported.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0

Runtime

 Project Readme

Flowerpot

Flowerpot is a wrapper for various messaging channels. Currently Telegram, CM Telecom and Twilio are supported.

Telegram

require "flowerpot"

x = Flowerpot::Flowerpot.new({telegram: {token: "telegram token", webhook_url: "url to webhook", chat_id_get: ProcToGetChatId, chat_id_save: ProcToSaveChatId}})

# serve the url you have configured as webhook_url somehow. there, call x.telegram.webhook with the request body.
# chat_id_get and chat_id_save must either be nil or procs to get and save username/chat_id mappings to your own storage.
# the specs for Flowerpot::TelegramClient give a little example for this.

# to send messages, the user must have written you previously so that the chat_id is known.
x.send_message(Flowerpot::TelegramMessage.new("receiving_username", "text"))

CM Telecom

require "flowerpot"

x = Flowerpot::Flowerpot.new({cmtelecom: {token: "cm telecom token", from: "sender id"}})
x.send_message(Flowerpot::CMTelecomMessage.new("receiving number", "text"))

Twilio

require "flowerpot"

x = Flowerpot::Flowerpot.new({twilio: {account_sid: "twilio account sid", auth_token: "twilio auth token", from: "sender id"}})
x.send_message(Flowerpot::TwilioMessage.new("receiving number", "text"))

Query configured transports

The usable (configured) transports can be queried with the transports method of Flowerpot::Flowerpot.