Class: SalesforceBulkAPINotifier::SlackService

Inherits:
Object
  • Object
show all
Defined in:
lib/salesforce_bulkapi_notifier/slack_service.rb

Instance Method Summary collapse

Constructor Details

#initializeSlackService

Returns a new instance of SlackService.



3
4
5
6
7
8
9
# File 'lib/salesforce_bulkapi_notifier/slack_service.rb', line 3

def initialize
  Slack.configure do |config|
    config.token = SalesforceBulkAPINotifier.slack_api_token
  end
  @slack ||= Slack::Web::Client.new
  @slack.auth_test
end

Instance Method Details

#notify(channels, text) ⇒ Object



11
12
13
14
15
# File 'lib/salesforce_bulkapi_notifier/slack_service.rb', line 11

def notify(channels, text)
  channels.split(',').each do |channel|
    @slack.chat_postMessage(channel: "#{channel}", text: "#{text}", as_user: true)
  end
end