34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/app/models/slack_notification.rb', line 34
def deliver_message
if SystemConfiguration.slack_configured?
start_processing
payload = { text: message }
payload[:channel] = to.presence || SystemConfiguration.slack_support_channel
payload[:username] = from.presence || Rails.env
RestClient.post(SystemConfiguration.slack_api_url, payload.to_json)
finish_processing
else
finish_processing 'Slack is not configured'
end
rescue StandardError => error
log_warn '!!! Error sending SLACK notification !!!', error
finish_processing error.message
end
|