Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3496c9c16a | ||
|
|
1b17926b90 | ||
|
|
b21e9849ba | ||
|
|
64db949581 | ||
|
|
8c1c1a5ab2 | ||
|
|
2971d78f8c | ||
|
|
7f8d8a112d | ||
|
|
68205d8fd3 | ||
|
|
d42206e03b |
+13
-7
@@ -36,7 +36,11 @@ class Integrations::Slack::IncomingMessageBuilder
|
||||
def should_process_event?
|
||||
return true if params[:type] != 'event_callback'
|
||||
|
||||
params[:event][:user].present? && params[:event][:subtype].blank?
|
||||
params[:event][:user].present? && valid_event_subtype?
|
||||
end
|
||||
|
||||
def valid_event_subtype?
|
||||
params[:event][:subtype].blank? || params[:event][:subtype] == 'file_share'
|
||||
end
|
||||
|
||||
def supported_event?
|
||||
@@ -93,7 +97,14 @@ class Integrations::Slack::IncomingMessageBuilder
|
||||
def create_message
|
||||
return unless conversation
|
||||
|
||||
@message = conversation.messages.create!(
|
||||
build_message
|
||||
process_attachments(params[:event][:files]) if params[:event][:files].present?
|
||||
@message.save!
|
||||
{ status: 'success' }
|
||||
end
|
||||
|
||||
def build_message
|
||||
@message = conversation.messages.build(
|
||||
message_type: :outgoing,
|
||||
account_id: conversation.account_id,
|
||||
inbox_id: conversation.inbox_id,
|
||||
@@ -102,10 +113,6 @@ class Integrations::Slack::IncomingMessageBuilder
|
||||
private: private_note?,
|
||||
sender: sender
|
||||
)
|
||||
|
||||
process_attachments(params[:event][:files]) if params[:event][:files].present?
|
||||
|
||||
{ status: 'success' }
|
||||
end
|
||||
|
||||
def slack_client
|
||||
@@ -131,7 +138,6 @@ class Integrations::Slack::IncomingMessageBuilder
|
||||
|
||||
attachment_obj = @message.attachments.new(attachment_params)
|
||||
attachment_obj.file.content_type = attachment[:mimetype]
|
||||
attachment_obj.save!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ slack:
|
||||
id: slack
|
||||
logo: slack.png
|
||||
i18n_key: slack
|
||||
action: https://slack.com/oauth/v2/authorize?scope=commands,chat:write,channels:read,channels:manage,channels:join,groups:read,groups:write,im:write,mpim:write,users:read,users:read.email,chat:write.customize,channels:history,groups:history,mpim:history,im:history
|
||||
action: https://slack.com/oauth/v2/authorize?scope=commands,chat:write,channels:read,channels:manage,channels:join,groups:read,groups:write,im:write,mpim:write,users:read,users:read.email,chat:write.customize,channels:history,groups:history,mpim:history,im:history,files:read
|
||||
hook_type: account
|
||||
allow_multiple_hooks: false
|
||||
webhooks:
|
||||
|
||||
Reference in New Issue
Block a user