Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

jlobos/slackhooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slackhooks

Build Status XO code style

Send data into Slack in real-time by Incoming Webhooks.

Install

npm install --save slackhooks

Usage

const slack = require('slackhooks')

// id or full url
const me = 'T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
const backend = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'

slack('Hey today is birthday of Camila :tada:', me)
// or if is need response
slack('Hey today is birthday of Camila :tada:', me).then(res => {
  console.log(res)
})

// Advanced message formatting (Attachments, Message buttons)
// https://api.slack.com/docs/messages/builder
slack({
  text: 'Status: Deploy done :ok_hand: Your build exited with 0.',
  username: 'docker',
  icon_emoji: ':whale:',
  link_names: 1,
  channel: '#backend'
}, backend)

License

MIT © Jesús Lobos