2016-12-20 21:14:33 +00:00
class SlackService < ChatNotificationService
2014-03-18 17:27:03 +00:00
def title
2016-11-25 19:36:37 +00:00
'Slack notifications'
2014-03-18 17:27:03 +00:00
end
def description
2016-11-25 19:36:37 +00:00
'Receive event notifications in Slack'
2014-03-18 17:27:03 +00:00
end
def to_param
2016-12-20 21:14:33 +00:00
'slack'
2014-03-18 17:27:03 +00:00
end
2015-09-15 18:46:11 +00:00
def help
2016-11-25 19:36:37 +00:00
' This service sends notifications about projects events to Slack channels . < br / >
To setup this service :
< ol >
< li > < a href = " https://slack.com/apps/A0F7XDUAZ-incoming-webhooks " > Add an incoming webhook < / a> in your Slack team. The default channel can be overridden for each event. < / li >
< li > Paste the < strong > Webhook URL < / strong> into the field below. < / li >
< li > Select events below to enable notifications . The channel and username are optional . < / li>
< / ol>'
2015-09-15 18:46:11 +00:00
end
2014-03-18 17:27:03 +00:00
def fields
2016-07-06 20:52:00 +00:00
default_fields + build_event_channels
2014-03-18 17:27:03 +00:00
end
2016-11-25 19:36:37 +00:00
def default_fields
[
{ type : 'text' , name : 'webhook' , placeholder : 'https://hooks.slack.com/services/...' } ,
{ type : 'text' , name : 'username' , placeholder : 'username' } ,
{ type : 'checkbox' , name : 'notify_only_broken_builds' } ,
{ type : 'checkbox' , name : 'notify_only_broken_pipelines' } ,
]
2016-07-13 19:49:47 +00:00
end
2016-11-25 19:36:37 +00:00
def default_channel
" # general "
2016-07-29 16:59:54 +00:00
end
2014-03-18 17:27:03 +00:00
end