Apps Home
|
Create an App
Chatty IFTTT
Author:
spookyk
Description
Source Code
Launch App
Current Users
Created by:
Spookyk
'use strict'; var iftttWebhookUrl = ''; // The URL of the IFTTT webhook you want to post to var tipTrigger = 2; // The total amount of tips for this app to trigger on var totalTipped = 0; // A running total of tips // Enables dynamic setings cb.settings_choices = [{ name: 'IFTTT Webhook Url', type: 'str', minLength: 1, maxLength: 100 }, { name: 'Tip Trigger', type: 'int', minValue: 1 }]; // Handles actually sending the IFTTT webhook request var sendRequest = function sendRequest(user, amount) { xhttp.open('POST', iftttWebhookUrl, true); xhttp.setRequestHeader('Content-type', 'application/json'); xhttp.send({ value1: user, value2: amount, value3: total }); }; // Registers the onTip handler cb.onTip(function (tip) { totalTipped += parseInt(tip['amount']); if (totalTipped >= tipTrigger) { sendRequest(tip['from_user'], tip['amount']); } }); var init = function init() { iftttWebhookUrl = cb.settings.iftttWebhookUrl; tipTrigger = cb.settings.tipTrigger; }; init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.