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
- JavaScript
- Python
- cURL
await fetch(
"https://api.okaya.me/webhooks/123456",
{
method: "GET",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());
import requests
requests.get("https://api.okaya.me/webhooks/123456",
headers={
"x-api-key": "YOUR_API_KEY"
}
).json()
curl --location "https://api.okaya.me/webhooks/123456" \
--header "x-api-key: YOUR_API_KEY"
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
- Invalid 'groupID'
- Group not found
{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }
{ "error": "Group not found" }
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
- JavaScript
- Python
- cURL
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());
import requests
requests.post("https://api.okaya.me/webhooks/123456",
headers={
"x-api-key": "YOUR_API_KEY"
},
json={
"url": "https://integration.example/webhook",
"description": "Webhook Description"
}
).json()
curl --location --request POST "https://api.okaya.me/webhooks/123456" \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"url": "https://integration.example/webhook",
"description": "Webhook Description"
}'
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
- Invalid 'groupID'
- Invalid 'url'
- Invalid 'description'
- Group not found
{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }
{ "error": "Invalid URL" | "You are missing the body parameter url" | "url must be a string" }
{ "error": "You are missing the body parameter description" | "description must be a string" }
{ "error": "Group not found" }
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
- JavaScript
- Python
- cURL
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());
import requests
requests.put("https://api.okaya.me/webhooks/123456/we_abcdefghijklmnopqrstuvwxyz",
headers={
"x-api-key": "YOUR_API_KEY"
},
json={
"url": "https://integration.example/newWebhook",
"description": "New Webhook Description"
}
).json()
curl --location --request PUT "https://api.okaya.me/webhooks/123456/we_abcdefghijklmnopqrstuvwxyz" \
--header "x-api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"url": "https://integration.example/newWebhook",
"description": "New Webhook Description"
}'
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
- Invalid 'groupID'
- Invalid 'webhookID'
- Invalid 'url'
- Invalid 'description'
- Webhook not found
- Group not found
{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }
{ "error": "You are missing the path parameter webhookID" }
{ "error": "Invalid URL" | "You are missing the body parameter url" | "url must be a string" }
{ "error": "You are missing the body parameter description" | "description must be a string" }
{ "error": "Webhook not found" }
{ "error": "Group not found" }
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
- JavaScript
- Python
- cURL
await fetch(
"https://api.okaya.me/webhooks/123456/we_abcdefghijklmnopqrstuvwxyz",
{
method: "DELETE",
headers: {
"x-api-key": "YOUR_API_KEY",
},
}
).then((response) => response.json());
import requests
requests.delete("https://api.okaya.me/webhooks/123456/we_abcdefghijklmnopqrstuvwxyz",
headers={
"x-api-key": "YOUR_API_KEY"
},
).json()
curl --location --request DELETE "https://api.okaya.me/webhooks/123456/we_abcdefghijklmnopqrstuvwxyz" \
--header "x-api-key: YOUR_API_KEY"
Example Response
200
{ "message": "success" }
400
- Invalid 'groupID'
- Invalid 'webhookID'
- Webhook not found
- Group not found
{ "error": "You are missing the path parameter groupID" | "groupID must be a number" }
{ "error": "You are missing the path parameter webhookID" }
{ "error": "Webhook not found" }
{ "error": "Group not found" }