Loyalty Points
Since the release of Streamlabs Loyalty System Extension, many people have started to use loyalty points on their channel. Here is how you can use the Streamlabs API to get loyalty points data.
1. Keep your access token handy!
Get your access token, username and channel. The access_token
allows you to access a user's Streamlabs data. The username
and channel
are the identifying elements that allow you to get a particular data. Once all set, make a simple API call in your favorite language as shown below.
import requests
url = "https://streamlabs.com/api/v2.0/points"
querystring = {"username":"username","channel":"channel"}
response = requests.request("GET", url, params=querystring)
print(response.text)
var data = JSON.stringify(false);
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://streamlabs.com/api/v1.0/points?access_token=access_token&username=username&channel=channel");
xhr.send(data);
require 'uri'
require 'net/http'
url = URI("https://streamlabs.com/api/v1.0/points?access_token=access_token&username=username&channel=channel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
curl --request GET \
--url 'https://streamlabs.com/api/v1.0/points?access_token=access_token&username=username&channel=channel'
2. Output
If your API call is successful, you should get a JSON file in return with the following data.
{
"id":1,
"platform":"twitch",
"channel":"sunnyding602",
"username":"sunnyding602",
"exp":0,
"points":470,
"ta_id":null,
"status":"vip",
"time_watched":0,
"created_at":null,
"updated_at":"2017-09-20 20:16:26"
}
3. Enjoy!
Updated almost 2 years ago