{"id":22316694,"url":"https://github.com/developerstoolbox/slackit","last_synced_at":"2025-03-26T03:25:28.698Z","repository":{"id":56896088,"uuid":"478045250","full_name":"DevelopersToolbox/slackit","owner":"DevelopersToolbox","description":"A simple rubygem for sending messages to slack.","archived":false,"fork":false,"pushed_at":"2022-04-21T11:45:09.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-24T15:43:15.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevelopersToolbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null},"funding":{"ko_fi":"wolfsoftware"}},"created_at":"2022-04-05T08:48:14.000Z","updated_at":"2022-06-07T19:17:29.000Z","dependencies_parsed_at":"2022-08-21T00:50:54.938Z","dependency_job_id":null,"html_url":"https://github.com/DevelopersToolbox/slackit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Fslackit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Fslackit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Fslackit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopersToolbox%2Fslackit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevelopersToolbox","download_url":"https://codeload.github.com/DevelopersToolbox/slackit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245581697,"owners_count":20639021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T23:07:33.806Z","updated_at":"2025-03-26T03:25:28.672Z","avatar_url":"https://github.com/DevelopersToolbox.png","language":"Ruby","funding_links":["https://ko-fi.com/wolfsoftware"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/\"\u003e\n        \u003cimg src=\"https://cdn.wolfsoftware.io/assets/images/github/organisations/developerstoolbox/black-and-white-circle-256.png\" alt=\"DevelopersToolbox logo\" /\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/slackit/actions/workflows/ci.yml\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/workflow/status/DevelopersToolbox/slackit/ci/master?style=for-the-badge\" alt=\"Github Build Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/slackit/releases/latest\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/v/release/DevelopersToolbox/slackit?color=blue\u0026label=Latest%20Release\u0026style=for-the-badge\" alt=\"Release\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/slackit/releases/latest\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/commits-since/DevelopersToolbox/slackit/latest.svg?color=blue\u0026style=for-the-badge\" alt=\"Commits since release\"\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\".github/CODE_OF_CONDUCT.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\".github/CONTRIBUTING.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contributing-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\".github/SECURITY.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/DevelopersToolbox/slackit/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://wolfsoftware.io/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Created%20by%20Wolf%20Software-blue?style=for-the-badge\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Overview\n\nSlackit is a very simply Ruby Gem for posting to a slack incoming webhook.\n\nIt is now possible to send attachments and blocks however slackit doesn't take responsibility for creating those only for sending them. For more information on how to use those please refer to the Slack API documentation.\n\n* [Attachments](https://api.slack.com/reference/messaging/attachments)\n* [Blocks](https://api.slack.com/block-kit/building)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'slackit'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install slackit\n\n## Usage\n\n```ruby\nrequire \"slackit\"\n```\n\n### Initialize client\n\n#### Initialize with minimal options\n\n```ruby\nclient = Slackit.new(webhook_url: \"slack webhook url\")\n```\n\n#### Initialize with all options\n\n```ruby\nclient = Slackit.new(\n  webhook_url: \"slack webhook url\",\n  channel: \"#development\",\n  username: \"mybot\",\n  icon_emoji: \":shipit:\",\n)\n```\n\n#### Initialize via shorthand method\n\n```Ruby\nclient = Slackit.new(options)\n```\n\n#### Validating the webhook url\n\nFirstly slackit will check to ensure that the webhook url starts with `https://hooks.slack.com/services`, this is the slack standard for all invalid webhook urls.\n\nSecondly slackit will attempt to validate the webhook url, by making a HTTP `GET` request, if the response to the request is a redirect to `https://api.slack.com` then the url is deemed to be invalid.\n\nThis checking can be bypassed by supplying the `-V` command line option to tell slackit this is a `valid` url, this is useful if you know that the URL is valid and working and removes the additional overhead of repeated testing for each message.\n\nIf you want to manually validate a url you can do this using the command line option -v\n\n```\nslackit -v -w \u003cslack webhook url\u003e\n```\n\nThis will run the GET test and also send a test message to the `general` channel to ensure that the supplied token is also valid, if this comes back with a success you `should` be safe to use the -V option from then on.\n\n\u003e Normal error handling during the post of a message will always be carried out.\n\n\n### Sending Messages\n\n#### Simple messages\n\n```Ruby\nclient.send_message(\"This is a test message\")\n```\n\n#### Attachments\n\n```Ruby\nclient.send_attachment(attachment_json)\n```\n\u003e NOTE: We will test to make sure the json is valid and catch errors thrown by the API for invalid formatting, missing values etc. General error from the api is `missing_text_or_fallback_or_attachments`\n\n#### Blocks\n\n```Ruby\nclient.send_block(block_json)\n```\n\n\u003e NOTE: We will test to make sure the json is valid and catch errors thrown by the API for invalid formatting, missing values etc. General error from the api is `invalid_blocks_format`\n\n### Command Line Usage\n\n```\nUsage: slackit\n    -h, --help                       Display this screen\n    -c, --channel string             The channel to send the message to\n    -i, --icon-emoji string          The emoji to use for the channel icon [default: :wolf:]\n    -m, --message string             The message to send\n    -w, --webhook-url string         The slack incoming webhook url to use\n    -u, --username string            The username to send as [default: slackit]\n\nWebhook Validation:\n    -v, --validation-test            Run a webbook validation test\n    -V, --validated-webhook          Flag the webhook as validated (skips constant validation)\n\nMessage type options:\n    -a, --attachment                 Treat the message as an attachment\n    -b, --block                      Treat the message as a block\n```\n\n#### Pipe message\n\nAlternatively to using the `-m` parameter, you can pipe your message instead:\n\n    $ echo 'Hello world!' | slackit -w ...\n\n#### Return values\n\nFor all sucessful sending slackit will return a value of 0. For all errors it will return the value of 1.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Testing\n\nFor local testing make sure that you run `bundle exec rspec spec` and then `rake install` to install the gem locally.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperstoolbox%2Fslackit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloperstoolbox%2Fslackit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperstoolbox%2Fslackit/lists"}