Tiago_R
February 14, 2019, 8:12am
1
Hi guys,
I’m trying to listen to some topic using the Twitch API but when I send a web socket request to server(wss://pubsub-edge.twitch.tv ) and using this (“topics”: [whispers.${id}] ) a get a response like that {“type”:“RESPONSE”,“error”:“Server Error”,“nonce”:“WyrvWclEkWsUTk4”}
Does anybody knows what could be ?
The whisper topic requires an oAuth/token to be passed.
You did not send that token, not even a blank one.
Tiago_R
February 14, 2019, 11:33am
3
Yes. I know it’s in the documentation, but I just tried everything and I’m still getting the same error. Could you help me If show you the code ? thanks
Tiago_R
February 14, 2019, 11:35am
4
Is it possible listens to all events for given streamer ?
Yes, but only if you have a oAuth/token from that streamer with the relevant scopes. And kinda weird to be listening in on their whispers.
Not really
but heres my listen send, near enough:
ws.send(JSON.stringify({
type: 'LISTEN',
nonce: 'ARandomString',
data: {
topics: ['atopic','anothertopic'],
auth_token: 'atoken'
}
});
atoken is not preceeded by oauth:
Tiago_R
February 14, 2019, 12:00pm
6
Thank you. Let me reformulate my question. Is it possible to listen to all events from a given streamer ? For example, I have a input text where I put some name e.g (patty) and then I open a wss to listen to all events that occur in patty’s channel.
You would have to listen each topic you want to listen on in the topics there is not a “single” topic you can listen on, that delivers everything, additionally not “everything” is available on PubSub.
So yes, but you’d have to call more than one topic in the listen send. Or send multiple listen messages
A better question is what “events” are you after, as not all “events” (or what I would class as an event I need to consume for my streamers) is available via PubSub.
TLDR: Define “events”
Tiago_R
February 14, 2019, 1:34pm
8
Events means any changes in a given user profile.
A user profile consists of a username, profile image, description, and if authorized to view an email.
That information can be collected via webhooks, not pubsub
https://dev.twitch.tv/docs/api/webhooks-guide/
Tiago_R
February 14, 2019, 1:38pm
10
Great. Do you have any sample code/project (JS) as a reference ? Thanks Barry.
I’m trying to set up the flow that would allow my application to subscribe to the Stream Up/Down Webhook but I’m having a lot of difficulty with it, and the example flow provides some guidance for what I need to do, but not much help for how to actually do it.
To preface this, I’m working in PHP which I don’t know a ton about, and I also don’t know a lot about the Twitch API or even just working with APIs in general, so if these questions seem pretty basic, that’s why.
Could someone send me …
I got some help for an issue I had last night and I am not sure if I should just continue to post in that topic or start a new one. If I need to delete this and update the other please let me know.
My new issue is as the title says I am getting hub.mode is required but its clearly there on line 3
also its not related to the API but I am trying to get my getUserID to return the results but I keep getting undefined.
So I get the subscription get verification thing, I echo the hub.challenge in PHP and from that point and on, I think everything is fine.
Now the problem comes after that, I tried subscribing using User Follows to_id=19571641 (which by the time of writing this is a Fortnite streamer with quite alot of viewers.
I get alot of empty POST requests, I try dumped $_POST array into a file every time someone goes on the page, I get alot of requests from an IP which appears to be coming from Amazon, bu…
So I’ve been trying to get a Webhook for subscribing to an event when a streamer gains a follower. I’m able to get Status Code 202 from the initial POST request. I’m not able to get the Subscription Verify Request from twitch to my callback URL. The callback URL is able to receive GET requests. The Client-ID works with many other api requests I’ve used.
I’ve looked at quite a few other’s codes, and multiple forums, haven’t had any success. If anyone would be able to give my code a glance it wou…
https://staging-discuss.dev.twitch.com/search?q=webhook%20js
https://dev.twitch.tv/docs/api/webhooks-guide/
https://dev.twitch.tv/docs/api/webhooks-reference/
It’s “standard” webhooks. Just like PayPal IPN, you just need to use a HTTP POST to create and maintain a subscription.
system
Closed
March 16, 2019, 1:40pm
12
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.