# Tiltify Integration

**URL:** <https://extensions.streamer.bot/t/tiltify-integration/250>\
**Category:** Approved\
**Tags:** obs, youtube, twitch\
**Created:** [September 6, 2023, 4:47pm UTC](https://extensions.streamer.bot/t/tiltify-integration/250 "2023-09-06T16:47:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![EarthToThien](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/earthtothien/32/557_2.png) [@EarthToThien](https://extensions.streamer.bot/u/EarthToThien)\
**Post date:** [September 6, 2023, 4:47pm UTC](https://extensions.streamer.bot/t/tiltify-integration/250/1 "2023-09-06T16:47:46Z")

</div>

Hi! This is an old version of the Tiltify extension, but it still works. I will be maintaining all future updates and information over on my site at [EarthToThien.github.io](https://earthtothien.github.io). Thank you so much for expressing interest in my passion project and supporting all the amazing charity organizations out there!

## Description

This is a detailed overview of the Tiltify Integration Extension for Streamer.Bot. The purpose of this extension is to serve as a foundation for streamers to connect their Streamer.Bot client to Tiltify and to have their own custom actions be triggered by donations to their Tiltify charity campaign.

## Video

[![](https://extensions.streamer.bot/uploads/default/original/2X/1/1475a9ef4ac32a8de959d0fc935ecac53205fe61.jpeg "Tiltify Alerts with Streamer.Bot! - Version 2.0") ](https://www.youtube.com/watch?v=CWug3SO2sJs)

## Requirements

- **Tiltify Account** - User will need a Tiltify account in order to gain the necessary access to Tiltify.

- **Tiltify Campaign** - User must have an active Tiltify campaign in order for the extension to work properly.

## Import Code

[Tiltify-StreamerBot Integration v2.1.sb](https://extensions.streamer.bot/uploads/short-url/sbe30KAvYMri6IHhTaXBBzrsiBp.sb) (9.0 KB)

## Installation

In the Streamer.Bot client, click on the Import option in the top menu. Drag the downloaded Import Code file into the Import String field. If done correctly, the Import Actions window should match the following image (Figure 1).

 ![Figure 1: Streamer.Bot import window](https://extensions.streamer.bot/uploads/default/original/2X/7/754f729c81516daefb905b7f93d1d9b9410fa7af.webp)

After importing the extension, the following items should appear in the Streamer.Bot client under the corresponding tabs:

_ **Actions Tab** _

- Tiltify - Generic Alert Action
- Tiltify - Recent Donation
- Tiltify - Recent Donation Alert
- Tiltify - Total Raised

_ **Queues Tab** _

- Tiltify - Access Code
- Tiltify

_ **Timed Actions Tab** _

- Tiltify - List Donations

**Access Token** and **List Donations** are the main actions for the extension. **Generic Alert** is an example alert action that can be used as a simple alert or an alert action template. **Total Raised** is an optional action if the user wants to display the current amount raised and the current goal for the Tiltify campaign. Under the Timed Actions Tab (Settings \> Timed Actions), the **Tiltify - List Donations** timer is disabled. Once configuration is complete and all alert actions are linked to the extension, the timer needs to be enabled to begin polling Tiltify.

## Configuration

### Get Access Token

In order to acquire a **Client ID** and **Client Secret** for the **Get Access Token** action, a Tiltify account is required. From the Tiltify dashboard, access the Developer Hub and create an application. The Redirect URI field needs to be populated in order to create an application, but it is not required for the extension function. For this, `http://localhost` is used as shown in Figure 2.

 ![Figure 2: Tiltify Create Application window, located under the Developer hub](https://extensions.streamer.bot/uploads/default/original/2X/6/6ca0e9ca44b9424d77edf7338a68fbb69c3b6342.webp)

After creating an app, a notification will appear indicating that the app was made successfully. Further down the page, there is a blurred section called “Application keys” that will provide the **Client ID** and **Client Secret** that are required for the extension to generate an **Access Token** (`accessToken_Tiltify`) for Tiltify access. The corresponding sub-actions under the **Get Access Token** action are then populated with the acquired information (Figure 3).

 ![Figure 3: The Tiltify Application keys are required for the Streamer.Bot client to generate an access token to poll Tiltify.](https://extensions.streamer.bot/uploads/default/original/2X/3/31941f1b859d0035d812426c1795616e176bad09.webp)

The extension also requires the user to have an active or published Tiltify charity campaign. From the Tiltify campaign dashboard, the public ID can be found under Information tab of Setup (Figure 4).

 ![Figure 4: The public ID is required to link the Tiltify campaign to the Streamer.Bot extension. This allows data to be obtained from the active campaign.](https://extensions.streamer.bot/uploads/default/original/2X/a/a3e2aa86e72133de530171633e4574d3843aebc8.webp)

### List Donations

The **List Donations** action serves as the trigger for all donation-based alerts. There is a repeating timer called **Tiltify - List Donations** that serves as the trigger for the **List Donations** action. With each trigger, the **List Donations** action polls Tiltify for the latest donation data from the current connected Tiltify campaign. This timer can be adjusted in the Streamer.Bot client under Settings \> Timed Actions and is defaulted at 2 second intervals.

Under the **List Donations** action, the **Execute Code (Tiltify Donor Data)** sub-action polls data from Tiltify and generates arguments using data from the most recent donation in the Tiltify charity campaign (see table below). These arguments are used in later sub-actions and can be used in alert actions. With each polling, `donationIdList_Tiltify`, which lists the `donationId` of the last five donations, is checked to see if it contains the donationId of the most recent Tiltify donation data. If the list does not contain it, `donationIdList_Tiltify` is updated to add the new donationId and remove the oldest donationId from the list. The other arguments are then generated, and the set alert actions are triggered.

| **Argument** | **Description** |
| --- | --- |
| `donationId` | Unique identifier assigned to each donation to the Tiltify campaign. This argument is used by the extension to determine whether or not there is a new donation to the Tiltify campaign. The last five `donationId` are saved and used as reference for new donations. |
| `donationDate` | Date and time (UTC) of when donation occurs. |
| `donorName` | Name provided with the donation to the Tiltify campaign. |
| `donorAmount` | Donation amount (USD) made to the Tiltify campaign. |
| `donorComment` | Message that donor included with the donation to the Tiltify campaign. |
| `donorRewards` | List of reward IDs of the rewards claimed with each donation to the Tiltify campaign. Each reward created for the Tiltify campaign is assigned a unique ID and appears in the data when claimed with each donation. |

There are two methods to trigger alert actions built into the **List Donations** action: Sub-Action Method and C# Method. Both methods are dependent on user preference and the complexity of the alert action triggers. The **List Donations** action has two different configurations based on the selected trigger alert method used. The Sub-Action Method and C# Method both are functionally similar, but depending on the complexity of the conditions to trigger alerts, the C# Method may be the recommended configuration. If based solely on conditions surrounding the `donorAmount` argument, the Sub-Action Method will provide a simpler setup. Once alert actions are linked to the **List Donations** action, the **Tiltify - List Donations** timer located under Settings \> Timed Actions needs to be enabled in order to begin polling Tiltify (Figure 5).

 ![Figure 5: Timed Actions settings for the List Donations action.](https://extensions.streamer.bot/uploads/default/original/2X/e/e240012545a5630456c42211bc3262d4f22784d3.webp)

### List Donation Methods

| | **Sub-Action Method** | **C# Method** |
| --- | --- | --- |
| **Pros** | 

Ease of use

Relies only on native sub-actions

 | 

Fully Customizable

Access to more conditions to trigger alert actions

Access to more functions through the Streamer.Bot C# Methods

 |
| **Cons** | 

Limited only to conditions with `donorAmount`

Limited to native sub-actions

 | 

Requires knowledge of C# programming

 |

#### Option A: Subaction Method

 ![Figure 6: Sub-Action Method configuration for the List Donations action. This is the default configuration for the Sub-Actions in red text are set to disabled.](https://extensions.streamer.bot/uploads/default/original/2X/b/b96b390a18e09b4b3cc4e40cf3ff40e748c673df.webp)

The Sub-Action Method uses native Streamer.Bot sub-actions to trigger alert actions and uses a configuration similar to the example shown in Figure 6. This configuration is provided upon installation of the extension, and if no other alerts will be used, it will be ready to be used as-is. Following the **Execute Code (Tiltify Donor Data)** sub-action, the **Run Action** sub-action triggers the alert actions. If the user only has one action for all donation alerts, the configuration shown in Figure 6 will be sufficient.

For different triggered alert actions under the Sub-Action Method, the **If/Else** sub-action is used to set different conditions for alerts as shown in the example in Figure 7. For each **If/Else** sub-action used, a “Break” must be set if the condition is met, otherwise “Continue” to check the next condition. If `donorAmount` is used for the conditions of the **If/Else** sub-actions, it is recommended that sub-actions be organized in descending order especially if comparatives (greater than, less than, etc.) are used. The last sub-action can be a **Run Action** sub-action for all donations that do not meet any of the established conditions.

 ![Figure 7: Example of If/Else setup for the Sub-Action Method of the List Donation action.](https://extensions.streamer.bot/uploads/default/original/2X/f/f441be0102292c4b64d77f8e98fd342c05ff74c1.webp)

#### Option B: C# Method

 ![Figure 8: C# Method configuration for the List Donation action. Sub-actions in red text are set to disabled.](https://extensions.streamer.bot/uploads/default/original/2X/6/6a8f4d4322fb60756ef398eeb9360879b19794d3.webp)

The C# Method uses the **Execute Code (Donation Alerts)** sub-action to trigger all alert actions and uses the configuration as shown in Figure 8. If this method is selected, all sub-actions for the Sub-Action Method must be disabled or removed from the **List Donations** action. All of the sub-actions used in the Sub-Action Method are already built into the C# code for the **Execute Code (Donation Alerts)** sub-action. In order to trigger different alert actions, C# conditions and If statements are used as seen in the example below (Figure 9).

```cs
//If donorAmount is greater than or equal to $100, trigger Action 3.
if (donorAmount >= 100m)
{
    CPH.RunAction("Tiltify - Alerts - Action 3", true);
}
//If donorAmount is greater than or equal to $25, trigger Action 2.
else if (donorAmount >= 25m)
{
    CPH.RunAction("Tiltify - Alerts - Action 2", true);
}
//If donorAmount is less than $25, trigger Action 1.
else
{
    CPH.RunAction("Tiltify - Alerts - Action 1", true);
}

```

Once the conditions are satisfied, the native C# method **CPH.RunAction()** is used to trigger the alert action. For more information on native C# methods in Streamer.Bot, refer to the wiki. Similar to the Sub-Action Method, it is recommended that the conditions be set in descending order if `donorAmount` is used.

### Alerts

Alert actions are triggered based on the conditions set in the **List Donations** action. When triggered, alert actions will have access to all the arguments generated by the **Execute Code (Tiltify Donor Data)** sub-action in the **List Donations** action (see table in List Donations section). The **Generic Alert** action is a simple example of how these arguments may be used (Figure 10). For the **Send Message to Twitch Channel** sub-action, the arguments `donorName` and `donorAmount` are used in a message to be sent to the Twitch chat (Figure 11).

 ![Figure 10: Sub-Action list for Generic Alert action is a simple Send Message to Twitch Channel sub-action using the donorName and donorAmount arguments.](https://extensions.streamer.bot/uploads/default/original/2X/e/e675b51930810542fc8b75f92b0cf66765841850.webp)

 ![Figure 11: Send Message to Twitch Channel sub-action in the Generic Alert action. This sub-action is used to send a charity message into chat after every new donation.](https://extensions.streamer.bot/uploads/default/original/2X/6/62b8e597de033ab7dbaf7af0517a566024219196.webp)

### Total Raised

**Total Raised** action is an optional feature that generates the following arguments listed in the following table. These arguments can be used to display the current progress of the Tiltify charity campaign. This action can be run by setting it as the last sub-action for each alert action (see example in Figure 10) or by setting a command or timer as the trigger.

| **Argument** | **Description** |
| --- | --- |
| `currentTotal` | The current amount raised for the Tiltify charity campaign. |
| `currentGoal` | The current goal set for the Tiltify charity campaign. |

## Changelog

### Version 2.1

- **List Donations** action updated. `donorAmount` argument updated to function constistently across all cultures. Added **CultureInfo.InvariantCulture** to the **Convert.ToDecimal()** for `donorAmount`.
- **Total Raised** action updated. `currentTotal` and `currentGoal` arguments updated to function consistently across all cultures. Added **CultureInfo.InvariantCulture** to the **Convert.ToDecimal()** for `currentTotal` and `currentGoal`.

### Version 2.0

- **Access Token** action renamed to **Get Access Token**.
- **Recent Donation** action renamed to **List Donations**.
- **Recent Donation** Alert action renamed to **Generic Alert**.
- **Recent Donation** timer renamed to **List Donations**.
- **List Donations** action updated. **Execute Code (Tiltify Donor Data)** sub-action updated to perform `donationId` check. The past five `donationId` will now be saved under the global argument `donationIdList_Tiltify`. All sub-actions related to `donationId` have been removed.
- **List Donations** action updated. **Execute Code (Tiltify Donor Data)** sub-action updated to include `donorRewards` output argument. This new argument will list the IDs of all the rewards claimed with each donation.
- **List Donations** action updated. Sub-actions have been updated to account for the two configurations: Sub-Action Method and C# Method (see List Donation Methods section for more details)
- **List Donations** updated. The **Get Global** (`accessToken`), **If/Else** , and **Get Global** (`publicId`) sub-actions have been consolidated into the **Execute Code (Tiltify Donor Data)** sub-action.
- **List Donations** action updated. New **Run Action** sub-action added to trigger the **Generic Alert** action.
- **List Donations** action updated. **Execute Code (Tiltify Donor Data)** updated to include `donorRewards` argument.
- **List Donations** action updated. **Execute Code (Tiltify Donor Data)** updated to include condition to trigger **Get Access Token** action if current _Access Token_ expires.
- **List Donations** action updated. **Execute Code (Tiltify Total Raised)** updated to include `currentGoal` output argument. This argument provides the current charity campaign goal set in Tiltify.

---

<div class="post-metadata">

**Author:** ![GoWMan](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/gowman/32/4_2.png) [@GoWMan](https://extensions.streamer.bot/u/GoWMan)\
**Post date:** [September 7, 2023, 2:36am UTC](https://extensions.streamer.bot/t/tiltify-integration/250/2 "2023-09-07T02:36:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TerrierDarts](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/terrierdarts/32/8_2.png) [@TerrierDarts](https://extensions.streamer.bot/u/TerrierDarts)\
**Post date:** [September 7, 2023, 11:50pm UTC](https://extensions.streamer.bot/t/tiltify-integration/250/3 "2023-09-07T23:50:42Z")

</div>

[https://extensions.streamer.bot/t/submission-template-check-before-submitting/222](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 🙂

---

<div class="post-metadata">

**Author:** ![EarthToThien](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/earthtothien/32/557_2.png) [@EarthToThien](https://extensions.streamer.bot/u/EarthToThien)\
**Post date:** [September 8, 2023, 2:03am UTC](https://extensions.streamer.bot/t/tiltify-integration/250/4 "2023-09-08T02:03:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pwnyy](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/pwnyy/32/2970_2.png) [@pwnyy](https://extensions.streamer.bot/u/pwnyy)\
**Post date:** [September 12, 2023, 4:03pm UTC](https://extensions.streamer.bot/t/tiltify-integration/250/5 "2023-09-12T16:03:58Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![EarthToThien](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/earthtothien/32/557_2.png) [@EarthToThien](https://extensions.streamer.bot/u/EarthToThien)\
**Post date:** [September 12, 2023, 7:45pm UTC](https://extensions.streamer.bot/t/tiltify-integration/250/6 "2023-09-12T19:45:17Z")

</div>

> [@pwnyy](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![pwnyy](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/pwnyy/32/2970_2.png) [@pwnyy](https://extensions.streamer.bot/u/pwnyy)\
**Post date:** [September 12, 2023, 10:30pm UTC](https://extensions.streamer.bot/t/tiltify-integration/250/7 "2023-09-12T22:30:44Z")

</div>

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! 😛 Not an issue tho!

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

---

<div class="post-metadata">

**Author:** ![pwnyy](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/pwnyy/32/2970_2.png) [@pwnyy](https://extensions.streamer.bot/u/pwnyy)\
**Post date:** [September 24, 2023, 10:06pm UTC](https://extensions.streamer.bot/t/tiltify-integration/250/8 "2023-09-24T22:06:01Z")

</div>

@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 😛

---

<div class="post-metadata">

**Author:** ![EarthToThien](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/earthtothien/32/557_2.png) [@EarthToThien](https://extensions.streamer.bot/u/EarthToThien)\
**Post date:** [September 25, 2023, 5:42am UTC](https://extensions.streamer.bot/t/tiltify-integration/250/9 "2023-09-25T05:42:46Z")

</div>

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.
