Class: Fastlane::Notification::Slack
- Inherits:
-
Object
- Object
- Fastlane::Notification::Slack
- Defined in:
- fastlane/lib/fastlane/notification/slack.rb
Defined Under Namespace
Classes: LinkConverter
Instance Method Summary collapse
-
#initialize(webhook_url) ⇒ Slack
constructor
A new instance of Slack.
-
#post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_names:, icon_url:, icon_emoji:) ⇒ Object
Overriding channel, icon_url, icon_emoji and username is only supported in legacy incoming webhook.
Constructor Details
#initialize(webhook_url) ⇒ Slack
Returns a new instance of Slack.
4 5 6 7 8 9 |
# File 'fastlane/lib/fastlane/notification/slack.rb', line 4 def initialize(webhook_url) @webhook_url = webhook_url @client = Faraday.new do |conn| conn.use(Faraday::Response::RaiseError) end end |
Instance Method Details
#post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_names:, icon_url:, icon_emoji:) ⇒ Object
Overriding channel, icon_url, icon_emoji and username is only supported in legacy incoming webhook. Also note that the use of attachments has been discouraged by Slack, in favor of Block Kit. api.slack.com/legacy/custom-integrations/messaging/webhooks
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'fastlane/lib/fastlane/notification/slack.rb', line 14 def post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_names:, icon_url:, icon_emoji:) @client.post(@webhook_url) do |request| request.headers['Content-Type'] = 'application/json' request.body = { channel: channel, username: username, icon_url: icon_url, icon_emoji: icon_emoji, attachments: , link_names: link_names }.to_json end end |