Yes I am using NGROK and yes it was tunneling, I can say that because I sent a dummy POST request on the https://<ngrok_url>/twitch/callback and I saw that request getting handled by my web server.
I will test it with some big twitch streamer and let you know.
My entire flow.
step 1. sending request to twitch to for subscribing.
await request({
url: API_BASE_URL + '/webhooks/hub',
method: 'POST',
headers: {
'Client-ID': this.config.clientId,
'Content-Type': 'application/json'
},
form: {
'hub.callback': https://<ngrok_url>/twitch/webhook?item.id=<random_string_a>',
'hub.mode': 'subscribe',
'hub.topic': 'https://api.twitch.tv/helix/users/follows?first=1&to_id=<twitch_channel_id>',
'hub.lease_seconds': 864000,
'hub.secret': <random_string_b>
},
json: true
});
step 2. Setting up webhooks in express so that it will accept requests coming from twitch.
router.get('/twitch/webhook', (req, res) => {
// confirms subscription
res.status(200).send(<challenge_string>);
});
router.post('/twitch/webhook', (req, res) => {
// my business logic
res.send(200);
});
step 3. I am getting getting GET /twitch/webhook, and once I send the <challenge_string> that I get from query string itself then I see a new entry when I fetch list of my active subscriptions from twitch.
step 4. Whenever I follow or unfollow the channel that has it’s id set to <twitch_channel_id> my web server should receive POST request from twitch with relevant data (which is not happening right now).