[SOLVED] Not receiving webhoock verification callback, workin ok till yesterday

I have setup a webhoock that listens the “stream changed” webhock endpoint, I’ve setup a cron job to update it every day at midnight.

It was correctly working until yesterday (since 2 month ago more or less), today I’ve received an email telling that my app is using the Helix api without OAuth tokens with are deprecated so I’ve started to migrate all to the new auth method.

The “old” API will be available until the end of this month, so the code I got it should still work.

What I’m trying to find before starting the migration is where the error is, I’ve found that I’m not receiving any callback after the subscribing to the webhoock event (I’m receiving a 202 code with an empty body which is the expected result) but I don’t get anything in the hub.callback url.

Here’s the resumed code I’m using (this server is using a reverse nginx proxy for https):

const express = require("express");
const request = require("request");

const app = express();
const proxy = express();

app.use(express.urlencoded({ extended: true }));

app.use("/bot/", proxy);

proxy.get("/", (req, res) => {

    if (req.query && req.query["hub.challenge"]) {
        console.log("Challenge verification received");

        res.set("Content-Type", "text/plain");

    } else {


// webhoock gets here
proxy.post("/", async (req, res) => {
    let userId = req.query["user_id"];
    let data = req.body.data[0];

    // obtain user data given his id
    let userInfo = await helper.getUserInfo(userId);

    console.log(`Webhoock for user ${userId} (${userInfo.display_name}) obtained.`);

    // stop streaming
    if (typeof data === "undefined") {
        console.log(`  User ${userInfo.display_name} is no longer live.`);

    // started streaming / updated stream data
    } else if (data.type === "live") {

        if ((Date.now() - new Date(data.started_at).getTime()) / 1000 <= MAX_LIVE_SINCE) {
            console.log(`  User ${userInfo.display_name} is live!`);

        } else {
            console.log("  Stream metadata changed.");


And the script I’m using to subscribe to the webhoock event:

const request = require("request");

const WEBSERVER_BASENAME = `${process.env.WEBSERVER_BASENAME}${(process.env.WEBSERVER_BASENAME.endsWith("/") ? "" : "/")}` || "/";

// Duration of the webhook, maximun value 864000 (10 days)
const LEASE_SECONDS = 24 * 60 * 60;

let baseReq = request.defaults({
    baseUrl: "https://api.twitch.tv/helix",
    headers: {
        "Accept": "application/json",
        "Client-ID": process.env.TWITCH_CLIENT_ID

async function streamsWebhoock(user, unsubscribe) {
    return new Promise(async (resolve, reject) => {
        if (typeof user === "string") {
            // obtain user information given his username
            let userInfo = await getUserInfo(user);
            user = userInfo.id;

        if (user) {
                uri: "/webhooks/hub",
                method: "POST",
                headers: {
                    "Content-Type": "application/json",
                body: JSON.stringify({
                    "hub.callback": `${WEBSERVER_ORIGIN}${WEBSERVER_BASENAME}?user_id=${user}`,
                    "hub.mode": (unsubscribe && unsubscribe === true) ? "unsubscribe" : "subscribe",
                    "hub.topic": `https://api.twitch.tv/helix/streams?user_id=${user}`,
                    "hub.lease_seconds": LEASE_SECONDS
            }, (err, res, body) => {
                if (err) {
                } else if (res && res.statusCode === 202) {
                    resolve(res, unsubscribe ? "unsuscribe" : "suscribe");

Edit: I’ve tried to do it with OAuth app tokens and I don’t either recieve any confirmation callbacks. Calling also to subscriptions show no results.

I don’t see anything obvious in your code.

So check your sever access logs to confirm if the GET request is getting to your NGINX server or not and then failing to get to your Node handler.

I’ve checked it and it does not recieve anything, I’ve even added a console.log and run it over the console to verify it.
The weird thing is that it worked perfectly yesterday…

Solved, it seemed that the service that was in charge to update the DNS with the dynamic ip was shutdown due to an error.
Everything is working correctly now.

Thanks to everyone!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.