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:
Sojan Jose
2023-03-29 18:48:16 +05:30
committed by GitHub
parent d1b65b6c9e
commit a4c9a2b2f2
5 changed files with 112 additions and 3 deletions

View File

@@ -30,7 +30,21 @@ RSpec.describe Webhooks::TelegramEventsJob, type: :job do
expect(Telegram::IncomingMessageService).to receive(:new).with(inbox: telegram_channel.inbox,
params: params['telegram'].with_indifferent_access)
expect(process_service).to receive(:perform)
described_class.perform_now(params)
described_class.perform_now(params.with_indifferent_access)
end
end
context 'when update message params' do
let!(:params) { { :bot_token => telegram_channel.bot_token, 'telegram' => { edited_message: 'test' } } }
it 'calls Telegram::UpdateMessageService' do
process_service = double
allow(Telegram::UpdateMessageService).to receive(:new).and_return(process_service)
allow(process_service).to receive(:perform)
expect(Telegram::UpdateMessageService).to receive(:new).with(inbox: telegram_channel.inbox,
params: params['telegram'].with_indifferent_access)
expect(process_service).to receive(:perform)
described_class.perform_now(params.with_indifferent_access)
end
end
end