Skip to content

Instantly share code, notes, and snippets.

@icio
Created Nov 29, 2013
Embed
What would you like to do?
Dominos Slack notifier

Dominos → Slack Notifier

Paste this snippet into your web browser's console when viewing the Pizza Tracker page offered after submitting a Dominos order. When the state changes it'll post the order state to your specified Slack Incoming Webhook. Use the URL at the top of your existing integration to paste into the prompt you receive when running the snippet. It should be in the form of: "https://TEAM.slack.com/services/hooks/incoming-webhook?token=TOKEN".

You'll need to leave your browser window open until it's done, of course. Tested in Chrome in the UK. Not tested with collections.

(function(endpoint) {
var prevState = null;
function notify(state) {
var params = "payload="+encodeURIComponent(JSON.stringify({
text: state,
username: "Dominos",
icon_emoji: ":pizza:",
}));
var n = new XMLHttpRequest();
n.open("POST", endpoint);
n.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
n.send(params);
}
setInterval(function () {
var state = (Array.prototype.slice.call(
pizzaTracker.document.getElementsByClassName("step-wrap")
).filter(function(e) {
return ~e.className.indexOf("-selected")
})[0] || {textContent: "Done"}).textContent.trim();
if (state != prevState) {
prevState = state;
notify(state);
}
}, 1000);
})(prompt("Slack Incoming Integration\n(https://TEAM.slack.com/services/hooks/incoming-webhook?token=TOKEN)"));
@riceo

This comment has been minimized.

Copy link

@riceo riceo commented Nov 29, 2013

Winning

@user-dotcom

This comment has been minimized.

Copy link

@user-dotcom user-dotcom commented Nov 29, 2013

your_mum

@mprzytulski

This comment has been minimized.

Copy link

@mprzytulski mprzytulski commented May 23, 2014

lol

@schoeffman

This comment has been minimized.

Copy link

@schoeffman schoeffman commented Apr 17, 2015

I made a chrome extension for this...only works on Domino's Canada at the moment. https://chrome.google.com/webstore/detail/slackn-dominos-tracking-n/ffbcjeiappfhhegcmccbhlhfkmldghpn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment