Chatwoot/app/jobs/webhooks/telegram_events_job.rb
Sojan Jose 671c5c931f
feat: Telegram Channel (#2901)
- Ability to configure telegram bots as a channel in chatwoot
- Receive a message sent to the telegram bot in chatwoot
- Ability to reply to telegram users from chatwoot
- Receive attachment messages in chatwoot

fixes: #1843
2021-09-10 00:00:52 +05:30

12 lines
368 B
Ruby

class Webhooks::TelegramEventsJob < ApplicationJob
queue_as :default
def perform(params = {})
return unless params[:bot_token]
channel = Channel::Telegram.find_by(bot_token: params[:bot_token])
return unless channel
Telegram::IncomingMessageService.new(inbox: channel.inbox, params: params['telegram'].with_indifferent_access).perform
end
end