2020-06-12 17:42:47 +00:00
|
|
|
module SlackStubs
|
|
|
|
def slack_url_verification_stub
|
|
|
|
{
|
2021-08-03 14:41:52 +00:00
|
|
|
token: 'Jhj5dZrVaK7ZwHHjRyZWjbDl',
|
|
|
|
challenge: '3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P',
|
|
|
|
type: 'url_verification'
|
2020-06-12 17:42:47 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def slack_message_stub
|
|
|
|
{
|
2021-08-03 14:41:52 +00:00
|
|
|
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: {}
|
2020-06-12 17:42:47 +00:00
|
|
|
}
|
|
|
|
end
|
2020-06-22 07:49:26 +00:00
|
|
|
|
2021-09-17 19:19:01 +00:00
|
|
|
def slack_attachment_stub
|
2022-04-28 15:39:39 +00:00
|
|
|
slack_message_stub.merge({ event: message_event_without_blocks })
|
2021-09-17 19:19:01 +00:00
|
|
|
end
|
|
|
|
|
2020-11-09 16:31:57 +00:00
|
|
|
def slack_message_stub_without_thread_ts
|
|
|
|
{
|
2021-08-03 14:41:52 +00:00
|
|
|
token: '[FILTERED]',
|
|
|
|
team_id: '',
|
|
|
|
api_app_id: '',
|
|
|
|
event: {
|
|
|
|
type: 'message',
|
|
|
|
client_msg_id: 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
|
|
|
|
text: 'this is test',
|
|
|
|
user: 'ULYPAKE5S',
|
|
|
|
ts: '1588623033.006000',
|
|
|
|
team: 'TLST3048H'
|
2020-11-09 16:31:57 +00:00
|
|
|
},
|
2021-08-03 14:41:52 +00:00
|
|
|
type: 'event_callback',
|
|
|
|
event_id: '',
|
|
|
|
event_time: 1_588_623_033,
|
|
|
|
authed_users: '[FILTERED]',
|
|
|
|
webhook: {}
|
2020-11-09 16:31:57 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-06-22 07:49:26 +00:00
|
|
|
def message_event
|
2020-11-09 16:31:57 +00:00
|
|
|
{
|
2021-08-03 14:41:52 +00:00
|
|
|
|
|
|
|
client_msg_id: 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
|
|
|
|
type: 'message',
|
|
|
|
text: 'this is test <https://chatwoot.com> Hey <@U019KT237LP|Sojan> Test again',
|
|
|
|
user: 'ULYPAKE5S',
|
|
|
|
ts: '1588623033.006000',
|
|
|
|
team: 'TLST3048H',
|
|
|
|
blocks: message_blocks,
|
2021-09-17 19:19:01 +00:00
|
|
|
files: file_stub,
|
2021-08-03 14:41:52 +00:00
|
|
|
thread_ts: '1588623023.005900',
|
|
|
|
channel: 'G01354F6A6Q',
|
|
|
|
event_ts: '1588623033.006000',
|
|
|
|
channel_type: 'group'
|
2020-11-09 16:31:57 +00:00
|
|
|
}
|
2020-06-22 07:49:26 +00:00
|
|
|
end
|
|
|
|
|
2021-09-17 19:19:01 +00:00
|
|
|
def file_stub
|
|
|
|
[
|
|
|
|
{
|
|
|
|
mimetype: 'image/png',
|
2021-11-11 07:33:48 +00:00
|
|
|
url_private: 'https://chatwoot-assets.local/sample.png',
|
2021-09-17 19:19:01 +00:00
|
|
|
name: 'name_of_the_file',
|
|
|
|
title: 'title_of_the_file',
|
|
|
|
filetype: 'png',
|
2021-11-11 07:33:48 +00:00
|
|
|
url_private_download: 'https://chatwoot-assets.local/sample.png'
|
2021-09-17 19:19:01 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2020-06-22 07:49:26 +00:00
|
|
|
def message_blocks
|
|
|
|
[
|
|
|
|
{
|
2021-08-03 14:41:52 +00:00
|
|
|
type: 'rich_text',
|
|
|
|
block_id: 'jaIv3',
|
|
|
|
elements: [
|
2020-06-22 07:49:26 +00:00
|
|
|
{
|
2021-08-03 14:41:52 +00:00
|
|
|
type: 'rich_text_section',
|
2022-04-28 15:39:39 +00:00
|
|
|
elements: [{
|
|
|
|
type: 'text',
|
|
|
|
text: 'this is test'
|
|
|
|
}]
|
2020-06-22 07:49:26 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
2022-04-28 15:39:39 +00:00
|
|
|
|
|
|
|
def message_event_without_blocks
|
|
|
|
{
|
|
|
|
client_msg_id: 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
|
|
|
|
type: 'message',
|
|
|
|
text: 'this is test <https://chatwoot.com> Hey <@U019KT237LP|Sojan> Test again',
|
|
|
|
user: 'ULYPAKE5S',
|
|
|
|
ts: '1588623033.006000',
|
|
|
|
files: file_stub,
|
|
|
|
thread_ts: '1588623023.005900',
|
|
|
|
channel: 'G01354F6A6Q'
|
|
|
|
}
|
|
|
|
end
|
2020-06-12 17:42:47 +00:00
|
|
|
end
|