Create Webhook for Facilities
POST/api/v2/public/webhooks/facility
We strongly recommend you set up webhooks for better and easier integration.
Creates a new webhook. Use this endpoint to register a new webhook by specifying the URL and the events you want to subscribe to.
Request
- application/json
Body
required
The URL that will be called when an event is triggered.
Possible values: [shift.request.created
, shift.request.cancelled
, shift.report.created
, shift.scheduled.cancelled
, shift.scheduled
, shift.created
, shift.report.accepted-automatically
, shift.report.accepted
, shift.report.rejected
, shift.cancelled
, all
]
The events that this webhook will listen to.
The IDs of the facilities that will receive events from this webhook. If no value is provided it will auto detect facilities that user has access
The secrets that will be used to verify the authenticity of the webhook.
If no value is provided it will auto generate a secret.
Secrets are used to sign and validate the payload of the webhook.
It will accept 2 secrets to allow a rotation strategy without service downtime.
Responses
- 201
- 400
- 401
- 403
- application/json
- Schema
- Example (from schema)
Schema
data object
If of the Webhook
Url of the Webhook
Possible values: [shift.request.created
, shift.request.cancelled
, shift.report.created
, shift.scheduled.cancelled
, shift.scheduled
, shift.created
, shift.report.accepted-automatically
, shift.report.accepted
, shift.report.rejected
, shift.cancelled
, all
]
List of events that this webhook will listen to
List of facilities ids that this webhook belongs to
List of webhook secrets
{
"data": {
"id": "9f08085c-9d51-49e6-bda0-e8b32e0f6605",
"url": "https://exemple.com/webhook",
"events": [
"shift.report.created",
"shift.request.created"
],
"clientId": "string",
"facilities": [
"P-123456",
"P-123457"
],
"secrets": [
"sDV1aKqitCLClI12m7UPFbAAvZfZquJw",
"mryefgHPBVHJwux0o3BYW7hPM0BZlcCa"
]
}
}
Bad request
- application/json
- Schema
- Example (from schema)
- Request Validation
Schema
Error description
The type of error
Status code of the error
{
"message": [
"Property must be a string"
],
"error": "Bad Request",
"statusCode": 400
}
Request Validation Error
{
"message": [
"should be a secure URL with HTTPS",
"url must be a string",
"events must contain at least 1 elements",
"events must be an array",
"each value in events must be one of the following values: shift.request.created, shift.request.cancelled, shift.report.created, shift.scheduled.cancelled, shift.scheduled, shift.created, shift.report.accepted-automatically, shift.report.accepted, shift.report.rejected, shift.cancelled, all",
"each value in facilities must be a string",
"secrets must contain no more than 2 elements",
"secrets must be an array"
],
"error": "Bad Request",
"statusCode": 400
}
Unauthorized
- application/json
- Schema
- Example (from schema)
Schema
Error description
Status code of the error
{
"message": "Unauthorized",
"statusCode": 401
}
Forbidden
- application/json
- Schema
- Example (from schema)
Schema
Error description
The type of error
Status code of the error
{
"message": "Forbidden Resource",
"error": "Forbidden",
"statusCode": 403
}