Grant raffle and giveaway tickets with the Roadie API
Roadie API · 4 min read ·
Let Firebot, Streamer.bot or your own bot give viewers tickets in a giveaway or a raffle prize with an API token, then send a test call and check it landed.
With the Custom API entry method, Roadie creates no reward and runs no chat command. Your own bot (Firebot, Streamer.bot or anything that can make a web request) decides who gets in, and tells Roadie how many tickets to give them.
Choose Custom API
When you add a giveaway or a raffle, Roadie first asks How will viewers get into this giveaway? (or raffle). Pick Custom API and press Continue. You can press Change to pick again until it starts.
- Giveaways: press Create giveaway, then open it again. Its Custom API panel now has a Token name list. Pick a token to see the grant call for this giveaway, and press Copy command to copy it with the token filled in.
- Raffles: your bot names the raffle by its slug (shown under its name on the Raffles list) and the prize by its number (the # on the prize list).
Tickets only count while the giveaway is active or the raffle prize is open.
Get an API token
- Open Settings › API Commands.
- Under API tokens, type a Token name that says which tool uses it, such as Firebot.
- Press Create API token, then Copy API token. It is shown only once.
Only the channel owner can create or copy a token. Every API token can call every Roadie API endpoint, so treat it like a password. Use one token per tool, so you can revoke one without breaking the rest. The table shows when each token was Last used.
The grant call
Send a POST to https://dashboard.roadie.gg/api/giveaway-tickets/grant with this header:
Authorization: Bearer YOUR_API_TOKEN
Put the values in the address after ?, or in a JSON body.
| Value | What it is |
|---|---|
giveaway | The giveaway's slug or ID. Leave it out when you name a raffle. |
raffle and prize | The raffle's slug or ID, and the prize number from 1 up. |
userId | Required. The viewer's numeric Twitch user ID. A name is not a substitute. |
login | Optional. The viewer's Twitch login, to label the entry. |
tickets | Optional. 1 to 1,000. Defaults to 1. |
A giveaway:
curl -X POST "https://dashboard.roadie.gg/api/giveaway-tickets/grant?giveaway=my-giveaway&userId=123456789&tickets=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Prize 2 of a raffle:
curl -X POST "https://dashboard.roadie.gg/api/giveaway-tickets/grant?raffle=my-raffle&prize=2&userId=123456789&tickets=5" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Firebot example
Add an HTTP Request effect to the command or event that should give the ticket:
- Method: POST
- URL:
https://dashboard.roadie.gg/api/giveaway-tickets/grant?giveaway=my-giveaway&userId=$userId&login=$username&tickets=1 - Headers:
Authorizationwith the valueBearer YOUR_API_TOKEN
Streamer.bot example
Streamer.bot's Fetch URL sub-action cannot send the Authorization header, so use an Execute C# Code sub-action:
using System.Net.Http;
public class CPHInline
{
static readonly HttpClient http = new HttpClient();
public bool Execute()
{
CPH.TryGetArg("userId", out string userId);
CPH.TryGetArg("userName", out string login);
string url = "https://dashboard.roadie.gg/api/giveaway-tickets/grant"
+ "?giveaway=my-giveaway&tickets=1"
+ "&userId=" + userId + "&login=" + login;
var request = new HttpRequestMessage(HttpMethod.Post, url);
request.Headers.Add("Authorization", "Bearer YOUR_API_TOKEN");
var response = http.SendAsync(request).Result;
CPH.LogInfo("Roadie: " + (int)response.StatusCode + " " + response.Content.ReadAsStringAsync().Result);
return true;
}
}
For a raffle, swap giveaway=my-giveaway for raffle=my-raffle&prize=2.
Send a test call
- Start the giveaway or open the raffle, so it can take tickets.
- On API Commands, open
/api/giveaway-tickets/grantin the Commands list. It shows every value, an example call and the answer. - Send one call: run the
curlabove in a terminal with your own token and Twitch user ID, or trigger your Firebot or Streamer.bot command once. - Read the answer.
"accepted": truewith"granted"means the tickets went in. Then check the viewer under Entrants, and the token's Last used time.
The Live feed on the same page (turn on Watch) shows clip, Stage view and live control calls as they arrive. Ticket grants do not show there, so use the answer, Entrants and Last used instead.
| Answer | Meaning |
|---|---|
200 | Done. accepted: false with a reason means no tickets were added. |
400 | A missing value, or tickets outside 1 to 1,000. |
401 | The token is missing, wrong or revoked. |
404 | No active giveaway or open prize by that name. |
409 | Refused: capped (at the ticket limit), paused or not-following. |
423 | Your Roadie account is paused. |
429 | Too many calls. Wait and try again. |
Questions? Email help@roadie.gg.