Create a webhook endpoint
const url = 'https://api.inboxcnx.com/v1/webhook-endpoints';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"url":"https://hooks.example.com/inboxcnx","events":["message.received","grant.created"],"description":"Production receiver"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.inboxcnx.com/v1/webhook-endpoints \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "url": "https://hooks.example.com/inboxcnx", "events": [ "message.received", "grant.created" ], "description": "Production receiver" }'Adds a URL that receives the subscribed webhook events of the caller application, signed with a secret returned only in this response. An application has at most 10 endpoints, and at most one of them subscribes to message.enrich. Events of a newly subscribed type that no endpoint has received yet, from the last 7 days, are delivered at once.
Requires the write:webhooks scope.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Example
{ "url": "https://hooks.example.com/inboxcnx", "events": [ "message.received", "grant.created" ], "description": "Production receiver"}Responses
Section titled “Responses”The endpoint, with its signing secret (returned only here)
object
Example generated
{ "id": "example", "url": "example", "description": "example", "events": [ "example" ], "createdAt": "example", "updatedAt": "example", "secret": "example"}Invalid body, or invalid_webhook_target: the URL must be https and must not point at a private address or an internal hostname
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The credential lacks the write:webhooks scope
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The caller’s application no longer exists
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The endpoint limit is reached, another endpoint already takes message.enrich, or the organization is still being set up; retry in a few minutes
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}