Feature: Slack - receive messages, create threads, send replies (#974)

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Sojan Jose
2020-06-22 13:19:26 +05:30
committed by GitHub
parent aa8a85b8bd
commit 1ef8d03e18
53 changed files with 815 additions and 188 deletions

View File

@@ -25,12 +25,39 @@ class Integrations::App
params[:fields]
end
def button
params[:button]
def action
case params[:id]
when 'slack'
"#{params[:action]}&client_id=#{ENV['SLACK_CLIENT_ID']}&redirect_uri=#{self.class.slack_integration_url}"
else
params[:action]
end
end
def active?
case params[:id]
when 'slack'
ENV['SLACK_CLIENT_SECRET'].present?
else
true
end
end
def enabled?(account)
account.hooks.where(app_id: id).exists?
case params[:id]
when 'slack'
account.hooks.where(app_id: id).exists?
else
true
end
end
def hooks
Current.account.hooks.where(app_id: id)
end
def self.slack_integration_url
"#{ENV['FRONTEND_URL']}/app/accounts/#{Current.account.id}/settings/integrations/slack"
end
class << self

View File

@@ -31,6 +31,6 @@ class Integrations::Hook < ApplicationRecord
end
def slack?
app_id == 'cw_slack'
app_id == 'slack'
end
end