{"id":13878119,"url":"https://github.com/CGA1123/slack-ruby-block-kit","last_synced_at":"2025-07-16T14:31:22.175Z","repository":{"id":41814859,"uuid":"173466890","full_name":"CGA1123/slack-ruby-block-kit","owner":"CGA1123","description":"A ruby wrapper for Slack's Block Kit","archived":false,"fork":false,"pushed_at":"2024-06-05T01:41:25.000Z","size":333,"stargazers_count":72,"open_issues_count":4,"forks_count":31,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-21T11:34:16.201Z","etag":null,"topics":["slack","slack-api","slack-blockkit"],"latest_commit_sha":null,"homepage":"https://rubydoc.info/gems/slack-ruby-block-kit","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/CGA1123.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-02T15:47:44.000Z","updated_at":"2024-09-12T06:11:15.000Z","dependencies_parsed_at":"2023-11-29T20:27:47.751Z","dependency_job_id":"e3d135b2-5b35-421d-9609-7e5acd2af71a","html_url":"https://github.com/CGA1123/slack-ruby-block-kit","commit_stats":null,"previous_names":["cga1123/slack_block_kit-ruby"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CGA1123%2Fslack-ruby-block-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CGA1123%2Fslack-ruby-block-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CGA1123%2Fslack-ruby-block-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CGA1123%2Fslack-ruby-block-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CGA1123","download_url":"https://codeload.github.com/CGA1123/slack-ruby-block-kit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226138849,"owners_count":17579496,"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":["slack","slack-api","slack-blockkit"],"created_at":"2024-08-06T08:01:40.379Z","updated_at":"2024-11-24T07:30:46.684Z","avatar_url":"https://github.com/CGA1123.png","language":"Ruby","funding_links":[],"categories":["Ruby",":hammer_and_wrench: \u0026nbsp; Libraries and SDKs"],"sub_categories":["Ruby"],"readme":"[![Gem Version](https://badge.fury.io/rb/slack-ruby-block-kit.svg)](https://badge.fury.io/rb/slack-ruby-block-kit)\n[![codecov](https://codecov.io/gh/CGA1123/slack-ruby-block-kit/branch/master/graph/badge.svg)](https://codecov.io/gh/CGA1123/slack-ruby-block-kit)\n\n# Slack::BlockKit\n\nA collection of ruby objects that represent Slack's block kit.\n\nYou can play around with the block kit using [Slack's block kit builder!](https://api.slack.com/tools/block-kit-builder)\n\nThe 'blocks' availables are split in line with how Slack documents them, that is:\n\n- `Slack::BlockKit::Layout` contains the [Layout blocks](https://api.slack.com/reference/messaging/blocks)\n- `Slack::BlockKit::Element` contains the [Block elements](https://api.slack.com/reference/messaging/block-elements)\n- `Slack::BlockKit::Composition` contains the [Message composition objects](https://api.slack.com/reference/messaging/composition-objects)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'slack-ruby-block-kit'\n```\n\n\nAnd then execute:\n\n    $ bundle\n\n\nOr install it yourself as:\n\n    $ gem install slack-ruby-block-kit\n\nFinally, require this:\n\n```ruby\nrequire 'slack-ruby-block-kit'\n```\n\n## Examples\n\nHere are a few examples that might help you get started!\n\n```ruby\nrequire 'faraday'\nrequire 'slack-ruby-block-kit'\nrequire 'json'\n\na_prebuilt_block = Slack::BlockKit::Layout::Section.new\ntext = Slack::BlockKit::Composition::Mrkdwn.new(text: ':wave: *hello*')\nan_image = Slack::BlockKit::Element::Image.new(image_url: 'https://git.io/fjDW8', alt_text: 'a picture')\na_prebuilt_block.accessorise(an_image)\na_prebuilt_block.text = text\n\nblocks = Slack::BlockKit.blocks do |b|\n  b.section do |s|\n    s.plain_text(text: 'Some plain text message!')\n    s.button(text: 'A button that is important', style: 'primary', action_id: 'id')\n  end\n\n  b.divider\n\n  b.context do |c|\n    c.mrkdwn(text: '_some italicised text for context_')\n  end\n\n  b.append(a_prebuilt_block)\nend\n\nbody = { blocks: blocks.as_json }\nwebhook_url = 'https://hooks.slack.com/services/your/webhook/url'\n\nresponse = Faraday.post(\n  webhook_url,\n  body.to_json,\n  'Content-Type' =\u003e 'application/json'\n)\n```\n\nThis will create a message like this:\n\n![example block message](https://git.io/fjDWR)\n\nSee [`./examples`](./examples/), and [`./examples/README.md`](./examples/README.md), for more worked examples and guidance.\n\nYou can also check out the [`slackerduty`](https://github.com/CGA1123/slackerduty) project for some more examples,\n[`Slackerduty::Alert`](https://github.com/CGA1123/slackerduty/blob/b33d708124ddf36d1432080ba7e16e66fefa6993/lib/slackerduty/alert.rb#L28-L34) and [`Slackerduty::Blocks`](https://github.com/CGA1123/slackerduty/blob/¦master/lib/slackerduty/blocks) may be helpful places to start.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/CGA1123/slack-ruby-block-kit\n\nSee [issues](https://github.com/CGA1123/slack-ruby-block-kit/issues) if you want any inspiration as to what to help with!\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Releasing\n\nReleasing is automated via the `.github/workflows/release.yml` which runs via\n[Trusted Publishing] authenticating with RubyGems via GitHub Action's OIDC\nintegration.\n\n- Update `CHANGELOG` for the latest version (remember to update the comparison links + add in an `Unreleased` section again)\n- Update `lib/slack/block_kit/version.rb` and run `bundle` to update the `Gemfile.lock`\n- Push that!\n- Run the `Release` workflow\n\n[Trusted Publishing]: https://guides.rubygems.org/trusted-publishing/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCGA1123%2Fslack-ruby-block-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCGA1123%2Fslack-ruby-block-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCGA1123%2Fslack-ruby-block-kit/lists"}