Webhooks Not Creating after Showing Successful Response

Hello,

I am able to create a Webhook and send a 200 status + X-Hook-Secret from the POST request. If I output webhooks from the creation, it will show me a Webhook ID, etc.

When I try to find the Webhook, it doesn’t exist. Do I need to add something else to confirm the creation of the Webhook? Please see code below, thank you.

var express = require('express');
var router = express.Router();
const asana = require('asana');
const client = asana.Client.create().useAccessToken('0/976b32*****************');

projectId = '938098182704541';

router.get('/', function (req, res, next) {
	client.webhooks.create('938098182704541', 'https://mydomain.com/asana-webhook-test/' + projectId)
		.then(function(webhooks) {
			console.log(webhooks);
			res.sendStatus(200);
		})
		.catch(function(err) {
			console.log(err.value);
			res.sendStatus(400);
		});
});

router.post('/' + projectId, function (req, res, next) {
	var xHookSecret = req.headers['x-hook-secret'];
	
	if (xHookSecret) {
		res.setHeader('X-Hook-Secret', xHookSecret);
		res.sendStatus(200);
	}
});

module.exports = router;

I get a response from ‘console.log(webhooks)’, but after finishing the running of the script, running client.webhooks.getAll(workspaceID) brings back 0 results. I checked in browser too and 0 results. Thank you.

2 posts were merged into an existing topic: Webhooks not working