This is a simple project designed to post messages to a given Slack channel as a bot.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
gem install slack_messaging
This project requires a config file that should look like this:
slack: channel: <AWESOME CHANNEL NAME> username: <AWESOME USER NAME> webhook_url: <SLACK WEBHOOK URL> icon_emoji: ":<SOME EMOJI>:"
The default is for the file to be named
~/.slack_messaging.yml, but a different path can be passed in like this:
$ slack-messaging --config="/PATH/TO/FILE/config.yml" slack
To obtain the webhook url, go to this link.
Okay, now the project will be ready to rock and roll.
To print a friendly message to Slack, run:
from the main directory. Here, no specific message is being given to print to Slack, so slack_messaging will choose a random quote. The random quotes are selected using the Quotable API.
However, what if you wanted to print something specific? Well, you can! Just run:
slack-messaging slack "MESSAGE 1"
You can even print multiple messages at once:
slack-messaging slack "MESSAGE 1" "MESSAGE 2" "MESSAGE 3" ... "MESSAGE N"
The output of slack_messaging will look something like this:
I hope you enjoy printing fun and specialized messages to Slack!
To run the tests, run
bundle exec rspec from the command line. GitHub Actions will also run the tests upon every commit to make sure they're up to date and that everything is working correctly. Locally, you can also run
bundle exec guard to automatically run tests as you develop! There are currently only tests for the
random_message classes. Feel free to help us add more!
To submit a feature request, bug ticket, etc, please submit an official GitHub Issue.
To report any security vulnerabilities, please view this project's Security Policy.
This repository does have a standard Code of Conduct.
To make a new release of this gem:
- Merge the pull request via the big green button
git tag vX.X.Xand
git push --tag
- Make a new release here
gem build *.gemspec
gem push *.gemto push the new gem to RubyGems
rm *.gemto clean up your local repository
To set up your local machine to push to RubyGems via the API, see the RubyGems documentation.