simple-slack-webhook

0.0.5 • Public • Published

Initialization

var slack = require('simple-slack-webhook');
 
slack.init({
    path: "/uri/path/to/webhook",
    username: "My awesome bot", // optional
    channel: "#general" // optional
});

Post a message

slack.text("Hello");

Post a message with attachments

var attachments = [{
    "fallback": "New ticket from Andrea Lee - Ticket #1943: Can't rest my password - https://groove.hq/path/to/ticket/1943",
    "pretext": "New ticket from Andrea Lee",
    "title": "Ticket #1943: Can't reset my password",
    "title_link": 'https://groove.hq/path/to/ticket/1943',
    "text": "Help! I tried to reset my password but nothing happened!",
    "color": "good"
}];
 
slack.attachments(attachments);

References

https://api.slack.com/docs/attachments

Package Sidebar

Install

npm i simple-slack-webhook

Weekly Downloads

3

Version

0.0.5

License

ISC

Last publish

Collaborators

  • mindesik