diff --git a/lib/integrations/slack/incoming_message_builder.rb b/lib/integrations/slack/incoming_message_builder.rb index a04f4e2bb..93f23d3a4 100644 --- a/lib/integrations/slack/incoming_message_builder.rb +++ b/lib/integrations/slack/incoming_message_builder.rb @@ -83,7 +83,7 @@ class Integrations::Slack::IncomingMessageBuilder message_type: :outgoing, account_id: conversation.account_id, inbox_id: conversation.inbox_id, - content: params[:event][:text], + content: Slack::Messages::Formatting.unescape(params[:event][:text] || ''), external_source_id_slack: params[:event][:ts], private: private_note?, sender: sender diff --git a/spec/lib/integrations/slack/incoming_message_builder_spec.rb b/spec/lib/integrations/slack/incoming_message_builder_spec.rb index a2b0bc603..ac89434c7 100644 --- a/spec/lib/integrations/slack/incoming_message_builder_spec.rb +++ b/spec/lib/integrations/slack/incoming_message_builder_spec.rb @@ -33,6 +33,7 @@ describe Integrations::Slack::IncomingMessageBuilder do allow(builder).to receive(:sender).and_return(nil) builder.perform expect(conversation.messages.count).to eql(messages_count + 1) + expect(conversation.messages.last.content).to eql('this is test https://chatwoot.com Hey @Sojan Test again') end it 'does not create message for invalid event type' do diff --git a/spec/support/slack_stubs.rb b/spec/support/slack_stubs.rb index e7cdb271d..28a25ba54 100644 --- a/spec/support/slack_stubs.rb +++ b/spec/support/slack_stubs.rb @@ -46,7 +46,7 @@ module SlackStubs { "client_msg_id": 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab', "type": 'message', - "text": 'this is test', + "text": 'this is test Hey <@U019KT237LP|Sojan> Test again', "user": 'ULYPAKE5S', "ts": '1588623033.006000', "team": 'TLST3048H',