I want to create webhooks using the node SDK (^22.3.1-rc.3), but running into an issue where the error i get on creation says that the request body is missing eventAction.
const webhookParams = {
subscription_url: subscriptionUrl,
event_action: '*',
event_object: '*'
};
const doesWebhookExists = await this.checkIfWebhookExists(webhookParams as AddWebhookRequest);
if (!doesWebhookExists) {
console.log('Webook does not exist yet');
await this.webhookApi
.addWebhook(webhookParams as WebhooksApiAddWebhookRequest)
.then(response => {
console.log(response);
return {
subscriptionUrl: response.data?.subscription_url || subscriptionUrl,
status: 'active',
description
};
})
.catch(error => console.error(error));
}
The error I’m getting:
{
success: false,
status: 'error',
code: 'ERR_SCHEMA_VALIDATION_FAILED',
message: "body must have required property 'eventAction'"
}
What’s strange is that the error is mentioning eventAction in camelcase, while the types are using underscores. I tried changing webhookParams to use camelcase, bypassing the types, but that did not work either. Am I calling the addWebhook method wrong?