Skip to content

Instantly share code, notes, and snippets.

@kotobuki
Last active October 14, 2018 06:50
Show Gist options
  • Save kotobuki/142337c3ecbc51ee244b977f154036c4 to your computer and use it in GitHub Desktop.
Save kotobuki/142337c3ecbc51ee244b977f154036c4 to your computer and use it in GitHub Desktop.
IFTTT Trigger
let fireButton;
let event;
let apiKey;
function setup() {
noCanvas();
event = createInput("event");
apiKey = createInput("key");
fireButton = createButton("Fire!");
fireButton.mousePressed(triggerRequested);
}
function triggerRequested() {
console.log("event: " + event.value());
console.log("key: " + apiKey.value());
const url =
"https://maker.ifttt.com/trigger/" +
event.value() +
"/with/key/" +
apiKey.value();
console.log(url);
httpPost(
url,
result => {
console.log("OK: " + result);
},
error => {
console.log("ERROR: " + error);
}
);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.sound.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.dom.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment