Next step after OAuth

I managed to get my OAUTH token and now I am trying to figure out 2 things.
A. how do I store it?
B. How do i use this token to make endpoint calls for new follower/ subscriber notifications.

I am using Karken (v5) right now

A. as you want
B. you need use webhooks

How you choose to store OAuth tokens is up to you, although you do need to keep them private so if you’re running a site, or have an app, you’ll ideally want to have the token stay on your backend rather than on the client.

For notifications, the best way to get follower notifications is to use webhooks, the guide for which can be found here

If webhooks, aren’t an option in your setup, then you’ll have to poll the follows endpoint

As for subscribers, there’s no webhook or Helix endpoint for that (it is on their roadmap for the 2nd half of this year), so your options are to either poll the v5 endpoint using a token from the channel you want to get subscribers for and with the channel_subscriptions scope.

Alternatively, you could use Chat or Pubsub if you want real-time notifications for subs.

please show some professionalism, this isn’t the overwatch forums.

Thanks Dist, is there an actual JS code example of how to access a webhook from the API?

From a high level perspective…

  1. You subscribe to a webhook
  2. Twitch sends back a request with a secret, you have to respond back with the secret, which verifies your subscription to the event
  3. When the event occurs Twitch will send a POST request to the URL that you subscribed on.
  4. You receive the request and then fire an event or whatever you want to do with it

You’re just doing an HTTP GET Request on that URL. Twitch will provide the formatted data, and you parse that. So you’d have to use some form of HTTP request library to handle the request from Twitch, and using callbacks you’d apply that to your front-end. I think generally speaking it’s better to handle the webhook server side and then pass the parsed data onto the client side.

If you’re doing this entirely client side then you need to account for the fact that the data won’t always be there when a user views the page.

EDIT: this looks like it might be helpful.

1 Like

Try to use google first, and read docs.
After that if something wrong then ask something on forum.
Show your professionalism. It’s not dota 2 forum.

1 Like

To think myself or anyone for that matter would not try and Google our questions first is incredibly ignorant. I am not going to devolve into a debate on this matter. I understand you might not like newbie questions and that is fine; ever profession has “those people” and I accept it for what it is. I am done with this matter altogether.

Also, just regurgitating a comment to act as an insult it fairly un-creative. Hopefully you can Google an original way of insulting people.

Thanks man, this is a huge help. An actual code example, thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.