Sha256: bbd54448f83b8709845e78b3df4d81b51a9ff1078df2598ca2a4fd8da5b54b7f
Contents?: true
Size: 911 Bytes
Versions: 2
Compression:
Stored size: 911 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require_relative '../lib/slack-ruby-block-kit' require_relative './config' require_relative './example_helper' 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 body = { blocks: blocks.as_json } puts JSON.pretty_generate(body) ExampleHelper.post_to_slack(body)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slack-ruby-block-kit-0.25.0 | examples/simple_example.rb |
slack-ruby-block-kit-0.24.0 | examples/simple_example.rb |