Skip to main content
Question

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

  • February 19, 2025
  • 1 reply
  • 15 views

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
Forum|alt.badge.img
  • Community Manager
  • 2312 replies
  • 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
}

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings