Added support for Telegram Business bots. Telegram webhooks from such bots include the business_message field, which we transform into a standard message for Chatwoot. This PR also modifies how we handle replies, attachments, and image uploads when working with Telegram Business bots. demo: https://drive.google.com/file/d/1Yz82wXBVRtb-mxjXogkUju4hlJbt3qyh/view?usp=sharing&t=4 Fixes #10181
This commit is contained in:
@@ -53,6 +53,24 @@ describe Telegram::UpdateMessageService do
|
||||
described_class.new(inbox: telegram_channel.inbox, params: caption_update_params.with_indifferent_access).perform
|
||||
expect(message.reload.content).to eq('updated caption')
|
||||
end
|
||||
|
||||
context 'when business message' do
|
||||
let(:text_update_params) do
|
||||
{
|
||||
'update_id': 1,
|
||||
'edited_business_message': common_message_params.merge(
|
||||
'message_id': 48,
|
||||
'text': 'updated message'
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
it 'updates the message text when text is present' do
|
||||
message = create(:message, conversation: conversation, source_id: text_update_params[:edited_business_message][:message_id])
|
||||
described_class.new(inbox: telegram_channel.inbox, params: text_update_params.with_indifferent_access).perform
|
||||
expect(message.reload.content).to eq('updated message')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when invalid update message params' do
|
||||
|
||||
Reference in New Issue
Block a user