0.0.5 • Published 8 years ago

simple-slack-webhook v0.0.5

Weekly downloads
13
License
ISC
Repository
github
Last release
8 years ago

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