
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
telegram-support-bot
Advanced tools
TelegramSupportBot
is a Ruby gem designed to enhance customer support through Telegram, allowing
for the management of queries directly from a designated chat while ensuring privacy and
confidentiality.
Add to your Gemfile:
gem 'telegram-support-bot'
TelegramSupportBot.process_update
.support_chat_id
by sending the /start
command to the bot inside the support chat.support_chat_id
, and set a
welcome message.TelegramSupportBot.configure do |config|
config.adapter = :telegram_bot
config.adapter_options = { token: 'YOUR_TELEGRAM_BOT_TOKEN' }
config.support_chat_id = 'YOUR_SUPPORT_CHAT_ID'
config.welcome_message = 'Hi! How can we help you?'
end
TelegramSupportBot
supports integration through adapters. Currently, telegram-bot
and telegram-bot-ruby
are supported.
Configuration is pretty much the same for both gems:
TelegramSupportBot.configure do |config|
config.adapter = :telegram_bot
config.adapter_options = { token: 'YOUR_TELEGRAM_BOT_TOKEN' }
end
TelegramSupportBot.configure do |config|
config.adapter = :telegram_bot_ruby
config.adapter_options = { token: 'YOUR_TELEGRAM_BOT_TOKEN' }
end
Basically, just make sure you call TelegramSupportBot.process_update
somewhere in you workflow
cycle and pass it a parsed json update received from Telegram servers.
telegram-bot
Gem with a Webhook ControllerIf you're using the telegram-bot
gem, set up a Rails controller to handle incoming webhook
requests. Here's an example of how you might implement such a controller:
class TelegramWebhooksController < ApplicationController
def webhook
update = JSON.parse(request.body.read)
TelegramSupportBot.process_update(update)
head :ok
end
end
Make sure to configure your routes to direct webhook callbacks to this controller action.
telegram-bot-ruby
Gem with bot.listenFor those utilizing telegram-bot-ruby, you can set up a simple listener loop to process incoming messages. This approach is more suited for polling rather than webhooks: require 'telegram/bot'
token = 'YOUR_TELEGRAM_BOT_TOKEN'
Telegram::Bot::Client.run(token) do |bot|
bot.listen do |message|
TelegramSupportBot.process_update(update.to_h)
end
end
Implement custom adapters by inheriting from TelegramSupportBot::Adapter::Base
and defining
message sending and forwarding methods.
bin/setup
to install dependencies.rake spec
for tests and bin/console
for an interactive prompt.bundle exec rake install
.version.rb
, and run bundle exec rake release
.Contributions are welcome via GitHub, adhering to the code of conduct.
Available under the MIT License.
Follow the project's code of conduct.
FAQs
Unknown package
We found that telegram-support-bot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.