The Twitch API doesn’t seem to get any response from the Twitch webhook. It might be linked to the ping websites ban as Twitch webhook might put a lot of pressure too.
I run my Discord bot with Discord.js
I also have access to the Twitch API with Twitch-Channel (twitch-channel - npm)
I copied and paste the example provided by twitch-channel and started doing my stuff with it but it turns out I don’t have access to 4 events which are using Twitch Webhooks. I already asked the creator of twitch-channel for some advices through GitHub but it turns out it should have been working.
Everything is correct, I just can’t receive anything back from webhook-based events. It might be because of Glitch… Can anyone provide an answer to why it doesn’t receive the webhook data ?
Code :
channel[guild.id] = new TwitchChannel({ channel: guildparam.sub, bot_name: "streamnotifierbot", // twitch bot login bot_token: "", // create your token here https://twitchapps.com/tmi/ client_id: "", // get it by registering a twitch app https://dev.twitch.tv/dashboard/apps/create (Redirect URI is not used) client_secret: "", // secret of your registered twitch app streamlabs_socket_token: guildparam.streamlabtoken, // get yours here https://streamlabs.com/dashboard#/apisettings in API TOKENS then "your socket API token" port: LocalPort, // the lib will listen to this port callback_url: "https://streamnotifier.glitch.me/", // url to your server, accessible from the outside world secret: "no", // any random string is_test: true // set to true to listen to test donations and hosts from streamlabs }); channel[guild.id].connect() channel[guild.id].on("follow", async ({ viewerId, viewerName }) => { fetched = db.fetch(`guildparam_${guild.id}`); if (fetched == null) var newguildparam = {prefix:"S!"}; else var newguildparam = fetched; if(newguildparam.sub != guildparam.sub) return await channel[guild.id].disconnect(); if(newguildparam.notifications.follow == true){ var tosend = newguildparam.message.follow .replace(/{viewerName}/g, viewerName) .replace(/{streamer}/g, newguildparam.sub) const embed = new Discord.RichEmbed() .setTitle('Follow') .setAuthor('StreamNotifier') .setColor('RANDOM') .addField(tosend,"\u200C") .setURL('https://twitch.tv/'+guildparam.sub) client.channels.get(newguildparam.channel).send(embed) } if(newguildparam.counter.follow !=""){ request.post("https://id.twitch.tv/oauth2/token?client_id=stuff&client_secret=stuff&grant_type=client_credentials&scope=stuff",function(error, response, body1){ body1 = JSON.parse(body1) request({ url: 'https://api.twitch.tv/helix/users/follows?first=1&to_id='+guildparam.subdata.id, headers: { 'Client-ID':'qrgioeji5fs7tvzthfy1j2175u6ohk', 'Authorization': "Bearer "+body1.access_token }}, function(error, response, body2){ body2 = JSON.parse(body2) client.channels.get(newguildparam.counter.follow).edit({ name: body2.total+" follows"}) }) }) } });
`