Sending Slack Notifications

Jobly comes bundled with Slack::Notifier which is made available to your jobs using the #slack method.

# jobs/greet.job
class Greet < Job
  # Optional settings (defaults to #debug and Jobly)
  # Can also be set in the configuration
  slack_channel '#debug'
  slack_user 'Greeter'

  def execute(name: 'bob')
    # Quick message "Hello #{name}"

    # Message with attachment attachments: { text: "Good text", color: "good" }

Sending notifications from other classes

To include the slack helper in other classes (non Jobly::Job), you can include the Jobly::Slack module (or the more inclusive Jobly::Helpers module).

# app/git.rb
class Git
  include Jobly::Slack

  def pull(repo) "pulling #{repo}"

See Also: Slack Notifications Example