i tried webhooks subscribe ‘https://api.twitch.tv/helix/subscriptions/events?broadcaster_id=1234567890&first=1’
i can get accept message, but no received events.
my code is->
var clientID = 'myID'
var contentType = 'application/json'
var postURI = 'https://api.twitch.tv/helix/webhooks/hub'
var secret = 'secretvalue'
var options =
{
headers: {
'Client-ID': clientID,
'Content-Type': contentType,
'Authorization':'Bearer '+'myToken'
},
uri: postURI,
method: 'POST',
json: {
"hub.mode":"subscribe",
"hub.topic":"https://api.twitch.tv/helix/subscriptions/events?broadcaster_id=123456789&first=1",
"hub.callback":"myCallback",
"hub.lease_seconds":864000,
"hub.secret":secret
}
}
request(options,function(e,r,b) {
console.log('Req status code : ' + r.statusCode);
if(r.statusCode === 202) {
console.log(r.statusMessage)
} else {
console.log;
}
});
route.post('/send',function (req,res) {
console.log('post');
req.on('data',function(chunk) {
var data = '';
data += chunk.toString();
var rst = JSON.parse(data);
console.log(rst);
});
res.status(200).send('done');
});
route.get('/send',function (req,res) {
console.log('get');
res.status(200).send(req.query['hub.challenge']);
});
thank you.