Call a url when user get reward with Channel Points

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.

1 Like

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

1 Like

the client-id is the Client ID of my app in Twitch Developers, right?

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

  1. 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
  1. 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"]
  1. 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”}”

Your call to validate returned the user_id as 168327867?
And the user whom clicked on your <a href in step 1 was murilo_rt?

It also seems that murilo_rt doesn’t actually have channel points enabled which might also explain this error.

And the error message is incorrect, but an error all the same