const options = {
method: 'POST',
headers: {
'x-api-key': '<your-api-key>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://your-app.com/webhook/omniai',
events: ['action_log.completed', 'action_log.failed'],
isEnabled: true,
description: 'Production webhook for CRM sync',
}),
};
fetch('https://api-v2.getomni.ai/api/v1/webhooks', options)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));