Skip to content

Instantly share code, notes, and snippets.

View andrewdodd's full-sized avatar

Andrew Dodd andrewdodd

View GitHub Profile
@andrewdodd
andrewdodd / sendToSlack.js
Last active May 16, 2016 11:07 — forked from scripting/sendToSlack.js
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.
import fetch from 'isomorphic-fetch'
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;