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

Tiltify - Recent Donation Alert example

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

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, an accessCode global variable will be generated with the Access Code provided by Tiltify.

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.

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!