From e5136c2691da01ec22a5bda7e2b238d348a43eb7 Mon Sep 17 00:00:00 2001 From: Tejaswini Chile Date: Thu, 28 Apr 2022 21:09:39 +0530 Subject: [PATCH] Fix: File upload from slack (#4494) When you upload a file from slack chat it's not appearing in the chatwoot inbox. This is because Slack updated the webhook event format --- spec/support/slack_stubs.rb | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/spec/support/slack_stubs.rb b/spec/support/slack_stubs.rb index 7644b6872..e37676c92 100644 --- a/spec/support/slack_stubs.rb +++ b/spec/support/slack_stubs.rb @@ -22,17 +22,7 @@ module SlackStubs end def slack_attachment_stub - { - token: '[FILTERED]', - team_id: 'TLST3048H', - api_app_id: 'A012S5UETV4', - event: message_event, - type: 'event_callback', - event_id: 'Ev013QUX3WV6', - event_time: 1_588_623_033, - authed_users: '[FILTERED]', - webhook: {} - } + slack_message_stub.merge({ event: message_event_without_blocks }) end def slack_message_stub_without_thread_ts @@ -95,15 +85,26 @@ module SlackStubs elements: [ { type: 'rich_text_section', - elements: [ - { - type: 'text', - text: 'this is test' - } - ] + elements: [{ + type: 'text', + text: 'this is test' + }] } ] } ] end + + def message_event_without_blocks + { + client_msg_id: 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab', + type: 'message', + text: 'this is test Hey <@U019KT237LP|Sojan> Test again', + user: 'ULYPAKE5S', + ts: '1588623033.006000', + files: file_stub, + thread_ts: '1588623023.005900', + channel: 'G01354F6A6Q' + } + end end