All Projects → CGA1123 → slack-ruby-block-kit

CGA1123 / slack-ruby-block-kit

Licence: MIT license
A ruby wrapper for Slack's Block Kit

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to slack-ruby-block-kit

Slack Ruby Client
A Ruby and command-line client for the Slack Web, Real Time Messaging and Event APIs.
Stars: ✭ 957 (+1814%)
Mutual labels:  slack-api
Slack Api Specs
Open API specifications for platform products by Slack
Stars: ✭ 148 (+196%)
Mutual labels:  slack-api
template-actionable-notifications
Sample Slack app to illustrate how incoming webhooks and interactive messages can be used to build a helpdesk integration
Stars: ✭ 31 (-38%)
Mutual labels:  slack-api
Bolt Starter
A Bolt ⚡️ app template with useful settings for easier development
Stars: ✭ 37 (-26%)
Mutual labels:  slack-api
Slack cleaner2
📝 Python3 module for deleting Slack messages and files using the Slack REST API
Stars: ✭ 92 (+84%)
Mutual labels:  slack-api
Bolt Python
A framework to build Slack apps using Python
Stars: ✭ 190 (+280%)
Mutual labels:  slack-api
Whatis
Whatis bot server for Slack!
Stars: ✭ 22 (-56%)
Mutual labels:  slack-api
deslackify
A program to delete old slack messages.
Stars: ✭ 19 (-62%)
Mutual labels:  slack-api
Slack Block Builder
Lightweight, no-dependency JavaScript library for creating Slack Block Kit UIs, with a builder syntax, inspired by SwiftUI.
Stars: ✭ 129 (+158%)
Mutual labels:  slack-api
admissions
Admissions is the gateway to Elixir School's private Slack
Stars: ✭ 18 (-64%)
Mutual labels:  slack-api
Slack Poster
Simple gem to post messages on Slack using web hooks.
Stars: ✭ 49 (-2%)
Mutual labels:  slack-api
Slack Machine
A sexy, simple, yet powerful and extendable Slack bot
Stars: ✭ 91 (+82%)
Mutual labels:  slack-api
Sclack
The best CLI client for Slack, because everything is terrible!
Stars: ✭ 2,363 (+4626%)
Mutual labels:  slack-api
Slack Api
A super simple PHP wrapper for Slack API
Stars: ✭ 34 (-32%)
Mutual labels:  slack-api
node-tasks-app
Tasks App is a sample Task Management app built on the Slack Platform.
Stars: ✭ 59 (+18%)
Mutual labels:  slack-api
Slack Cli
Powerful Slack CLI via pure bash. Rich messaging, uploads, posts, piping, oh my!
Stars: ✭ 850 (+1600%)
Mutual labels:  slack-api
Slack Watchman
Monitoring your Slack workspaces for sensitive information
Stars: ✭ 159 (+218%)
Mutual labels:  slack-api
slacking
Modern Slack C++ 11 library for communicating with the Web Slack API
Stars: ✭ 58 (+16%)
Mutual labels:  slack-api
template-announcement-approvals
Sample Slack app that uses the Events API and interactive message to implement an approvals workflow
Stars: ✭ 73 (+46%)
Mutual labels:  slack-api
Slacknimate
👯 Realtime text animation for Slack chatops
Stars: ✭ 250 (+400%)
Mutual labels:  slack-api

Gem Version codecov DeepSource DeepSource

Slack::BlockKit

A collection of ruby objects that represent Slack's block kit.

You can play around with the block kit using Slack's block kit builder!

The 'blocks' availables are split in line with how Slack documents them, that is:

Installation

Add this line to your application's Gemfile:

gem 'slack-ruby-block-kit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install slack-ruby-block-kit

Finally, require this:

require 'slack-ruby-block-kit'

Examples

Here are a few examples that might help you get started!

require 'faraday'
require 'slack-ruby-block-kit'
require 'json'

a_prebuilt_block = Slack::BlockKit::Layout::Section.new
text = Slack::BlockKit::Composition::Mrkdwn.new(text: ':wave: *hello*')
an_image = Slack::BlockKit::Element::Image.new(image_url: 'https://git.io/fjDW8', alt_text: 'a picture')
a_prebuilt_block.accessorise(an_image)
a_prebuilt_block.text = text

blocks = Slack::BlockKit.blocks do |b|
  b.section do |s|
    s.plain_text(text: 'Some plain text message!')
    s.button(text: 'A button that is important', style: 'primary', action_id: 'id')
  end

  b.divider

  b.context do |c|
    c.mrkdwn(text: '_some italicised text for context_')
  end

  b.append(a_prebuilt_block)
end

webhook_url = 'https://hooks.slack.com/services/your/webhook/url'
body = { blocks: blocks.as_json, text: 'New block message!' }

response = Faraday.post(
  webhook_url,
  body.to_json,
  'Content-Type' => 'application/json'
)

This will create a message like this:

example block message

You can also check out the slackerduty project for some example, Slackerduty::Alert and Slackerduty::Blocks may be helpful places to start.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/CGA1123/slack-ruby-block-kit

See issues if you want any inspiration as to what to help with!

License

The gem is available as open source under the terms of the MIT License.

Releasing

Releasing is automated via the .github/workflows/release.yml which allows for an OTP code to be passed in to authorize the release with MFA. If GitHub Actions is running slow it might take another attempt to make sure the OTP code is still valid when the workflow tries to push.

  • Update CHANGELOG for the latest version (remember to update the comparison links + add in an Unreleased section again)
  • Update lib/slack/block_kit/version.rb and run bundle to update the Gemfile.lock
  • Push that!
  • Run the Release workflow
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].