New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

actionslack

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

actionslack

  • 0.1.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

ActionSlack

ActionSlack is a framework that supports your implementation of slack notification functionality, inspierd by Rails.

Installation

gem 'actionslack', require: 'action_slack'

That's all

Usage

First, prepare a file with name 'config/slack_webhooks.yml' and register name and url fields of Slack Incoming Webhook as array.

- name: channel_onboarding
  url: https://hooks.slack.com/services/DUMMY/INCOMING_WEBHOOK_URL

Next, define two methods. One is the template for the message to be sent. The other must be a name of one of addresses you have just registered in config/slack_webhooks.yml.

Once everything is registered, you just call method notify to that template.

class WelcomingNewCommer < ActionSlack::Base
  self.attributes = [:new_person]

  def webhook_name
    'channel_onboarding'
  end

  def message
    <<~MSG
      Welcome, #{new_person.name}
    MSG
  end
end

class Person
  attr_reader :name

  def initialize(name)
    @name = name
  end
end

person = Person.new('John')

WelcomingNewCommer.notify(new_person: person)

Optionally, three configuration items are available.

Especially, there are three options for type: local, testflight, and production.

In local, ActionSlack does not post to Slack, only writes logs. In testflight, ActionSlack will post to Slack, but adds an obvious prefix to the message to tell you that it is not a notice from a production environment. So, I recommend to use it for checking connections.

I know you understand about production mode.

ActionSlack.configure do |config|
  config.filepath = "#{PROJECT_ROOT}/webhooks.yml"
  config.async = false # then, we don't use ActiveJob for posting
  config.type = :production
end

Development

I'm planning provide rspec tools.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kakubin/actionslack. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Code of Conduct

Everyone interacting in the ActionSlack project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 29 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc