Coder Social home page Coder Social logo

slack_send_gem's Introduction

SlackSend

Send messages to slack users with only a valid response url or a bot token and slack user id.

Installation & Bundler Dependency

With Rubygems

To install SlackSend with RubyGems:

gem install slack_send

Bundler Dependency

To use SlackSend in a project managed with Bundler:

gem 'slack_send', '>= 0.0.1'

Configuration

The bot token must be configured in the gem setup before you can send any message without passing a valid response url. You can do this anywhere in your application before using the gem.

SlackSend.configure do |config|
  config.bot_token = ''
end
  • bot_token - your Slack API bot token

Getting a bot token requires a (free) Slack account and that you agree to the terms of use for the API.


Basic Usage

With a response url

SlackSend.reply(
  response_url: 'a.valid.slack/response/url',
  message: {},
  attachments: [],
  response_type: 'in_channel'
)
  • response_url - a valid slack response url
  • message - a correctly formatted message
  • attachments - optional an array of correctly formatted attachments
  • response_type - optional optional - will default to 'ephemeral' if not passed 'in_channel'

With a user id

SlackSend.send(
  user_id: 'lizard123',
  message: {},
  attachments: []
)
  • user_id - a valid slack user id
  • message - a correctly formatted message
  • attachments - optional an array of correctly formatted attachments

requires bot token configuration as above


Message Formatting

See the Slack API documentation for the required format for slack messages and attachments.

Formatting Guidelines for Messages

Formatting Guidelines for Attachments

Slack Message Builder


Author: Liz Ardolino

slack_send_gem's People

Watchers

James Cloos avatar Liz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.