hello, I want that when the user redeems a reward with channel points, I call a URL so that I integrate this point spend with my external website, how can I do it?
Get channel point redeems endpoint is here
Or you want EventSub
Then Twitch can tell your server a redeem occured and do whatever you need there.
thanks for the quick response (amazing), my wish is, the user accumulates channel points by watching my lives, and then, when he redeems a certain reward, I notify my website and if possible, inform the cost of this reward (how many points were needed to rescue her)⌠any example?
my intention is to create a ranking system based on these points within my site.
The things I linked will provide this data.
The only thing left is to write the code to match the implmetnation for your website. And choose to use eventsub or polling the API periodicially.
for polling the api i use this?
Yes.
If you call that URL with the correct token and paramters. Then youâll get the redeems people have done.
ok, how to get the reward_id of an a reward?
Call Get Custom Rewards and lookt for the ID that matches you reward
i was getting
â{âerrorâ:âForbiddenâ,âstatusâ:403,âmessageâ:âcustom reward was created by a different client_id or channel points are not available for the broadcasterâ}â
Youâll only get that error if you are trying to modify the reward or redeemeds of any award youâll still be able to read all rewards.
For security reasons you can only update rewards (and redeems of a reward) created by your clietnID
Correct
I am using the same Authorization token i use in the login, and now, the error i get is â{âerrorâ:âUnauthorizedâ,âstatusâ:401,âmessageâ:âincorrect user authorizationâ}â
This suggests you didnât use a token that is for the streamer.
And/or the token is not a user token
And/or you are missing the relevant scope for the enedpoint
on the documentation â Developers only have access to get and update redemptions for the rewards created programmatically by the same client_id
â its means only the owner off the app can read the redemptions or others users can red yours redempetions of the channel off the app?
It means that your clientID can only manage rewards created by your ClientID
good morning, can i post my codes here, for you help me?
That is the purpose of this forum
- my button for login contains the href:
https://id.twitch.tv/oauth2/authorize?client_id=vdevjpxyrzii52pqjuomsvomixeazr&redirect_uri=http://localhost:8000/murilo/api/login_postback&response_type=code&scope=user:read:email+channel:read:redemptions
- in my server (python) i do a request to get the cliente token:
code = request.vars.code
scope = request.vars.scope
import requests
import json
url = 'https://id.twitch.tv/oauth2/token?client_id=vdevjpxyrzii52pqjuomsvomixeazr&client_secret=MY_CLIENT_SECRET&code=' + code + '&grant_type=authorization_code&redirect_uri=http://localhost:8000/murilo/api/login_postback'
r = requests.post(url)
session.access_token = r.json()["access_token"]
session.refresh_token = r.json()["refresh_token"]
- the login is ok, i can get the client profile user_id and login on the url
https://id.twitch.tv/oauth2/validate
with the token stored on session.access_token, then i do the call for get the redemptions:
import requests
headers = {
'Client-Id': 'vdevjpxyrzii52pqjuomsvomixeazr',
'Authorization': 'Bearer %s' % session.access_token
}
url = 'https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?broadcaster_id=168327867&reward_id=07342d45-dab9-4ce7-a461-9ed853aabeb0&id=07342d45-dab9-4ce7-a461-9ed853aabeb0'
r = requests.get(url,headers=headers)
return r
and the return is â{âerrorâ:âUnauthorizedâ,âstatusâ:401,âmessageâ:âincorrect user authorizationâ}â