Skip to main content

Webhooks API

A group has a number of associated webhooks we will use to send data upon certain events.

Get All Webhooks for a Certain Group

GET /webhooks/{groupID}

Retrieves a list of all webhooks associated with a group.

Headers

{ "x-api-key": "YOUR_API_KEY" }

URL Parameters

  • groupID (required): The group ID of the group you want to view the webhooks of.

Example Call

await fetch(
"https://api.okaya.me/webhooks/123456",
{
method: "GET",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());

Example Response

200

[
{
"id": "we_abcdefghijklmnopqrstuvwxyz",
"description": "Webhook Description",
"object": "webhook_endpoint",
"status": "enabled",
"url": "https://integration.example/webhook",
"enabledEvents": ["user.created", "user.session.result"]
}
]

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

401: Unauthorized

Create a New Webhook For A Specific Group

POST /webhooks/{groupID}

Create a new webhook for your group. Currently supported events are user.created and user.session.result.

Headers

{ "x-api-key": "YOUR_API_KEY" }

URL Parameters

  • groupID (required): The group ID of the group you want to create a new webhook for.

Body

{
"url": "https://integration.example/webhook",
"description": "Webhook Description"
}

Example Call

await fetch(
"https://api.okaya.me/webhooks/123456",
{
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
url: "https://integration.example/webhook",
description: "Webhook Description",
}),
}
).then((response) => response.json());

Example Response

200

{
"id": "we_abcdefghijklmnopqrstuvwxyz",
"description": "Webhook Description",
"object": "webhook_endpoint",
"status": "enabled",
"url": "https://integration.example/webhook",
"enabledEvents": ["user.created", "user.session.result"]
}

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

401: Unauthorized

Update an Existing Webhook

PUT /webhooks/{groupID}/{webhookID}

Update attributes of an existing webhook.

Headers

{ "x-api-key": "YOUR_API_KEY" }

URL Parameters

  • groupID (required): The group ID of the group you want to update webhooks for.
  • webhookID (required): The webhook ID of the webhook you want to update.

Body

{
"url": "https://integration.example/newWebhook",
"description": "New Webhook Description"
}

Example Call

await fetch(
"https://api.okaya.me/webhooks/123456/we_abcdefghijklmnopqrstuvwxyz",
{
method: "PUT",
headers: {
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
url: "https://integration.example/newWebhook",
description: "New Webhook Description",
}),
}
).then((response) => response.json());

Example Response

200

{
"id": "we_abcdefghijklmnopqrstuvwxyz",
"description": "New Webhook Description",
"object": "webhook_endpoint",
"status": "enabled",
"url": "https://integration.example/newWebhook",
"enabledEvents": ["user.created", "user.session.result"]
}

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

401: Unauthorized

Delete an Existing Webhook

DELETE /webhooks/{groupID}/{webhookID}

Delete an existing webhook.

Headers

{ "x-api-key": "YOUR_API_KEY" }

URL Parameters

  • groupID (required): The group ID of the group you want to delete a webhook from.
  • webhookID (required): The webhook ID of the webhook you want to delete.

Example Call

await fetch(
"https://api.okaya.me/webhooks/123456/we_abcdefghijklmnopqrstuvwxyz",
{
method: "DELETE",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());

Example Response

200

{ "message": "success" }

400

{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }

401: Unauthorized