I am currently setting up a subscription to tell when a streamer goes live, I was able to set up the subscription, and confirm that the subscription is active
subscribe function:
async function subscribe(userid){
let sub = await axios.post(‘https://api.twitch.tv/helix/webhooks/hub’, {
‘hub.callback’: ‘http://develocode.com:3000/userLive’,
‘hub.mode’: ‘subscribe’,
‘hub.topic’: 'https://api.twitch.tv/helix/streams?user_id=’+userid,
‘hub.lease_seconds’: 864000,
‘hub.secret’: ‘XXXXXXXXX’
})
return sub;
}
checking my subscription with this function:
async function checkSubscriptions(){
await axios.get(‘https://api.twitch.tv/helix/webhooks/subscriptions?first=10&after=eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6IiJ9fQ’, { headers: { Authorization: ‘Bearer ixxxxxxxxxxxxxxs’ } })
.then(response =>{
console.log(response.data);
} ).catch(err => {
console.log(err);
})
}
response:
{ total: 1,
data:
[ { topic: ‘https://api.twitch.tv/helix/streams?user_id=7xxxxxxx8’,
callback: ‘http://mysite.com:3000/userLive’,
expires_at: ‘2020-04-02T00:09:25Z’ } ],
pagination: {} }
however when I go live, I am the subscription is not update for me.
any idea of what this could be?
using nodejs, and express
currently I am just trying to return a request body
app.post('/userLive', jsonParser, (req, res) => {
let body = req.body;
console.log(body);
// Checks this is an event from a page subscription
res.status(200).send('EVENT_RECEIVED');
});