Tiltify Integration

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.

Video Tutorial

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 as https://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. It is IMPORTANT that this information is entered correctly. If entered properly, an accessCode_Tiltify global variable will be generated with the Access Code provided by Tiltify.

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 then begin poll the Tiltify API every 2 seconds for new 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 polling the Tiltify API every 2 seconds for new donation information. Every donation will have the following variables associated with it:

  • donorName - Name assigned to the donation to the Tiltify campaign
  • donorAmount - Donation amount (USD) made to the Tiltify campaign
  • donationId - Unique identifier assigned by Tiltify to each donation
  • donorComment - Message assigned to the donation made by the donor

For every poll, 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. The previousDonationId_Titlify will be updated to the most recent donationId to be used as a reference for the next poll and prevent dulplicate triggers. This will be followed by subactions related to your own custom alert (see example below).

Tiltify - Recent Donation Alert

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.

Global Variables

The following global variables will be generated and used in the Tiltify integration:

  • accessToken_Tiltify- Access token generated from the Client ID and Client Secret. This is requried in order to pull information from the published Tiltify campaign. See Tiltify API Reference for more information.
  • publicId_Tiltify - Unique identifier for the published Tiltify campaign. This can be accessed under the Setup tab of the campaign.
  • previousDonationId_Tiltify - A unique donationId will be assigned to each donation by Tiltify. This information will be saved under this global variable and used as a reference check every time Tiltify - Recent Donation is triggered. If donationId and previousDonationId_Tiltify match, then no new donations have been made and Tiltify - Recent Donation Alert will not be triggered.

References

Changelog

Version 1.8.1

  • Quick hotfix in case data polled from Tiltify is null. Added the following line of code (Line 27) in the Execute Code (Tiltify Donor Data) subaction for the Tiltify - Recent Donation action to check if data pulled is null. If so, a break in action is triggered and no alert should occur.
    image

Version 1.8

  • Moved Tiltify - Recent Donation action to Tiltify queue and removed Titlify - Recent Donation Alert from Tiltify queue.
  • Simplified subactions for Tiltify - Recent Donation Alert action for ease of use
  • Added comments in Tiltify - Recent Donation Alert action for users who are interested in creating their own actions.
    Tiltify - Recent Donation Alert update
  • Added comments and sub-action in Tiltify - Recent Donation action for users who are interested in creating alert variations based on different donation amounts.
    Tiltify - Recent Donation Update for Alert Variations
  • Timer for Tiltify - Recent Donation has been added with Streamer.Bot import file
  • Simplified subactions for Tiltify - Total Raised action. This action can be triggered by being run as a subaction for Tiltify - Recent Donation Alert or similar actions or can be triggered with a command or timer.
    image
2 Likes

I’ve adjusted the attachments to be able to add more, if it’s not enough just let me know. Should allow you to post more images and convert the Import Code to an .sb file. Also would suggest adding tags so it will sort in the docs pages upon approval. Also helps people know if something’s cross platform or not.

1 Like

https://extensions.streamer.bot/t/submission-template-check-before-submitting/222

Thanks for writing up your extension, I wonder if you could make a couple of really small adjustments to some of the formatting/headings.

Under the Import Code header should only be the Import File.

You should then use “Installation” to explain how to set it up

Configuration will explain how the user can change thing to match there needs

This Format is important because it allows user to know where to find each bit of infomation and it helps keep all the pages looking the same (alot of users 1st language isnt English for a strict format is helpful)

Once again thank you for adding it in the first place :slight_smile:

I’ll definitely work on the format! Thanks for the feedback!

1 Like

Heya! Thanks for the submission! While going through I noticed some things not potentially working and one concern.

Problems:

  • I’m assuming that you would need to run the “Tiltify - Access Token” first and foremost after setting the clientId and clientSecret. In the best case, you would mention this and probably add a Test trigger and describe after setting the Ids to Test the Test trigger, so it executes the action once.
  • When executing the “Tiltify - Access Token” action it will return a
    System.Net.WebException: The remote server returned an error: (422) Unprocessable Entity. error in the GetAccessToken method. Unsure if this is due to current problems with the service or something else. Assumed it might be due the my campaign not being published but even after publishing this still happened. Maybe something to look into.
  • ^ Technically I can’t really test further, however after setting the global variables (publicId and accessToken) and trying the “Recent Donation” action the “Tiltify Donor Data” Code will give the following error: System.ArgumentNullException: Value cannot be null. Parameter name: s at System.IO.StringReader..ctor(String s)
    → Additionationaly the “Tiltify Total Raised” action will then respond with a System.Net.WebException: The remote server returned an error: (401) Unauthorized. error. Unsure if these were due to my account being just created, so if you still can check up on these errors it would be nice.

Concern:

I would advise you to use unique global variable names. As accessToken and publicId etc might be global variables names that are way to generic so there is a high possibility that they will interfere with a users other variables if they potentially use other extensions. Could probably go for something like: publicId_tiltify_EarthToThien. Just try to think of something that should be unique enough!

Hey Pwnny, that 422 error is a credential error from Tiltify. Make sure you copy and pasted your Client ID and Client Secret correctly into Access Token action in Streamer.Bot. The Client ID and Public ID is required to generate an Access Code from Tiltify, which is used by the Recent Donation action to pull recent donation data from the current campaign. Client ID and Client Secret are inputs for Access Token action alone.

Thanks for the recommendation with the variables. I tried to match it up with Tiltify’s system for easy reference in case any troubleshooting is needed. I’ll keep that in mind for next time and maybe add a variable library.

1 Like

After you mentioned the credential error, I checked the app settings again, seems like the URI request URL was not correct which is turn well made the errors. Just tested the rest again and seems to be working fine as long as the campaign is published, which might be worth mentioning not that people will try and say it ain’t giving me something! :stuck_out_tongue: Not an issue tho!

So yeah basically my only complaint/concern would be the global variable names :slight_smile: Certainly, like the part which you added with the screenshot of the credentials!

@EarthToThien Would you mind changing the global variable names that are being used? I know you said that you tried to keep it in line with the Tiltify system, however, for me it’s still a possible issue in the future. Could make the naming convention at the end like publicId_TiltifyETT, accessToken_TiltifyETT as an example.

This will be checked for future extensions as well, not only you don’t worry :stuck_out_tongue:

Global variables have been updated in the import file. Post has been updated with information and new images to reflect this update. Global Variables section has been added along with explanation for each variable.

1 Like