Slack | Drupal.org

Slack brings all your communication together in one place. It’s real-time messaging, archiving and search for modern teams, and it has cool system integrations features. This module allows you to send messages from Drupal website to Slack. It has Rules module integration. Also you can use our module API in your modules.

Source: Slack | Drupal.org

scripting / sendToSlack.js – a small node.js app that posts to Slack.

A tiny JavaScript app that sends a message to your default Slack channel. Can be customized with a name, icon, emoji or sent to a different channel. Runs in Node.js.


var request = require ("request");
var urlWebHook = "https://hooks.slack.com/services/abcdef"; //the URL you get on your "incoming web hooks" page.
function sendToSlack (s, theUsername, theIconUrl, theIconEmoji, theChannel) {
var payload = {
text: s
};
if (theUsername !== undefined) {
payload.username = theUsername;
}
if (theIconUrl !== undefined) {
payload.icon_url = theIconUrl;
}
if (theIconEmoji !== undefined) {
payload.icon_emoji = theIconEmoji;
}
if (theChannel !== undefined) {
payload.channel = theChannel;
}
var theRequest = {
url: urlWebHook,
method: "POST",
json: payload
};
request (theRequest, function (error, response, body) {
if (!error && (response.statusCode == 200)) {
console.log ("sendToSlack: " + s);
}
else {
console.log ("sendToSlack: error, code == " + response.statusCode + ", " + response.body + ".\n");
}
});
}
sendToSlack ("Hello World");

view raw

sendToSlack.js

hosted with ❤ by GitHub

My Twitter Digest for 05/22/2015