I try to use these api
Topic: User Follows / Topic: User Changed / Topic: Hype Train Event / Topic: Subscription Events
Follows, Changed, Hype Train Event, are normally subscribed.
url = ‘https://api.twitch.tv/helix/webhooks/subscriptions’;
let subs = await axios({ method: ‘GET’, url, headers: { Authorization: Bearer ${access_token}
, ‘Client-ID’: client_id }});
result:
{ topic:
‘https://api.twitch.tv/helix/users/follows?first=1&to_id=id’,
callback: ‘https://address/usr/callbackTwitch’,
expires_at: ‘2020-09-20T06:03:04Z’ },
{ topic: ‘https://api.twitch.tv/helix/users?id=id’,
callback: ‘https://address/usr/callbackTwitch’,
expires_at: ‘2020-09-20T06:03:04Z’ },
{ topic:
‘https://api.twitch.tv/helix/hypetrain/events?broadcaster_id=id&first=1’,
callback: ‘https://address/usr/callbackTwitch’,
expires_at: ‘2020-09-20T06:03:05Z’ } ],
pagination: {} }
but Topic: Subscription Events is not subscribed.
request
let data = {
‘hub.callback’: callback,
‘hub.mode’: mode,
‘hub.topic’: https://api.twitch.tv/helix/users/follows?first=1&to_id=${id}
,
‘hub.lease_seconds’: ‘864000’,
};
data[‘hub.topic’] = https://api.twitch.tv/helix/subscriptions/events?broadcaster_id=${id}&first=1
;
await axios({ method: ‘POST’, url, headers: { Authorization: Bearer ${access_token}
, ‘Client-ID’: client_id }, data });
exports.cbGET = async(req, res) => {
res.send(req.query[‘hub.challenge’]);
};
exports.cbGET.method = ‘get’;