chore: Support telegram edited_message events (#6785)
- Add support for telegram edited_message events: Update the user message back in the Chatwoot dashboard when updated by the contact on telegram
This commit is contained in:
@@ -7,6 +7,18 @@ class Webhooks::TelegramEventsJob < ApplicationJob
|
||||
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
|
||||
process_event_params(channel, params)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_event_params(channel, params)
|
||||
return unless params[:telegram]
|
||||
|
||||
if params.dig(:telegram, :edited_message).present?
|
||||
Telegram::UpdateMessageService.new(inbox: channel.inbox, params: params['telegram'].with_indifferent_access).perform
|
||||
else
|
||||
Telegram::IncomingMessageService.new(inbox: channel.inbox, params: params['telegram'].with_indifferent_access).perform
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user