Skip to main content
New Participant
February 19, 2025
Question

Failed to create subscription: WebHook responds with incorrect HTTP status. HTTP status is 404

I have an unbuntu server running apache with virtual directories.  I’m getting the following  error when I attempt to register a webhook:  Failed to create subscription: WebHook responds with incorrect HTTP status. HTTP status is 404.  

The code that is rendering this error is: 

async function createSubscription() {
try {
let response = await platform.post('/restapi/v1.0/subscription', {
eventFilters: [
"/restapi/v1.0/account/~/extension/~/telephony/sessions"
],
deliveryMode: {
transportType: "WebHook",
address: process.env.WEBHOOK_URL
}
});
console.log("Subscription created:", response.data);
} catch (error) {
console.error("Failed to create subscription:", error.message);
}
}

 

    1 reply

    PhongVu
    Community Manager
    Community Manager
    February 21, 2025

    You should make sure that your webhook endpoint is publicly accessible. You must also make sure that you capture the ‘validation-token’ and return it in the header within 3 secs. In Node JS code, it looks like this.

    if(req.headers.hasOwnProperty("validation-token")) {
    res.setHeader('Validation-Token', req.headers['validation-token']);
    res.statusCode = 200;
    res.end();
    }else{
    // read the event data
    }