Description
This serves as a foundation for the user to connect their Streamer.Bot client to the Tiltify API and create their own custom donation alerts and stream interactions for their charity events.
Requirements
-
Tiltify Account - You will need an account in order to obtain a Client ID and Client Secret. Instructions to do this are in the Tiltify API documentation. You will need this in order to generate an Access Code for Streamer.Bot to communicate with the Tiltify API.
Note: When generating an oAuth application in Tiltify, a Redirect URI is not necessary for this code. It can be set ashttps://localhost
. -
Tiltify Campaign Public ID - This can be found on your campaign page under Setup > Information. The campaign must be published in order for the extension to function properly.
Import Code
Installation
In Streamer.Bot click on the Import
button in the top menu. Drag the .sb file into the Import String
field.
If imported correctly, there should be the following:
Actions
- Tiltify - Access Code
- Tiltify - Recent Donation
- Tiltify - Recent Donation Alert
- Tiltify - Total Raised
Queues
- Tiltify - Access Code
- Tiltify
Configuration
The Tiltify account and campaign information (Client ID, Client Secret, & Public ID) should be entered in their respective sub-actions in the Tiltify - Access Code action.
To ensure the Execute Code sub-actions in each action (Tiltify - Access Code, Tiltify - Recent Donation, & Tiltify - Total Raised) have the correct references, click on the Find Refs
and Save and Compile
buttons.
A 2-second timer should be set as the trigger for the Tiltify - Recent Donation. StreamerBot will the ping Tiltify API every 2 seconds for donation information.
How It Works
Assuming all actions are enabled and the 2-second timer is set for the Tiltify - Recent Donation
action, StreamerBot will begin pinging the Tiltify API every 2 seconds for donation information. Every donation will have the following variables associated with it:
- donorName
- donorAmount (in USD)
- donationId (unique to donation)
- donorComment (in case donor left a message with their donation)
For every ping, StreamerBot will perform a check if the new donationId matches the previousDonationId. If they are the same, no new donations have been made, but if they are different, the Tiltify - Recent Donation Alert
action will trigger. This is where you can add your own custom interactions and logic statements (see example below). After those sub-actions are performed, the previousDonationId will be updated to the most recent donationId and be used as a reference for the next ping.
The Access Code for the Tiltify API expires every 7200 seconds. If an expired code is used, C# code in the Tiltify - Recent Donation
action will detect an error and trigger the Tiltify - Access Code
action to generate a new Access Code and update the global variable accessCode for all actions to use.
The Tiltify - Total Raised
action is optional, but can be used to update the total amount raised for the charity campaign. Additional custom interactions and logic statements can be added here for milestone goals.
References
- Tiltify API Reference - Intro | Tiltify
Notes
- There was a use case where two people have donated within seconds of each other, and the alerts got stuck in a loop on the most recent donation. I have not been able to repeat that error, but restarting Streamer.Bot resolved the issue.
- It is important that the Client ID and Client Secret copied correctly in the
Tiltify - Access Token
action. If entered properly, anaccessCode
global variable will be generated with the Access Code provided by Tiltify.