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.

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.

Import

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 - 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 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.

image

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

Notes

  • It is important that the Client ID and Client Secret copied correctly in the Tiltify - Access Token action. If entered properly, an accessCode_Tiltify global variable will be generated with the Access Code provided by Tiltify.
  • Updated Tiltify - Recent Donation Alert and moved the Set global variable subaction to the beginning to prevent the possibility of double alerts/infinite loop from occurring. Download file and images have been updated accordingly.

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