Creating Webhook via API
This guide will walk you through the process of creating your first webhook using an API. Follow the steps below to set up and configure the webhook.
Set Up the HTTP Request
To create a webhook, you'll need to send a POST request to the webhook endpoint.
Here’s how you can structure your request (Example from sandbox):
Method: POST
URl: api-sandbox.fndev.com/api/v1/webhooks
Headers: Authorization: Bearer YOUR_ACCESS_TOKEN
Body: (JSON)
{
"events": ["workorder.created"],
"url": "https://yourwebhookendpoint.com",
"method": "post"
}
Example Request
curl --location 'https://api-sandbox.fndev.net/api/v1/webhooks' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"events": [
"workorder.created",
"workorder.status.approved"
],
"url": "https://yourwebhookendpoint.com",
"method": "post"
}'
Example Response
{
"metadata": {
"timestamp": "Wed, 04 Sep 2024 10:58:28 GMT"
},
"result": {
"webhookId": "cd3d33d2-43e4-4123-974a-f027dfa230dd",
"companyId": 1,
"userId": 1,
"events": ["workorder.created", "workorder.status.approved"],
"url": "https://yourwebhookendpoint.com",
"method": "post",
"status": "active",
"secret": "e5d2a46b-8180-40c8-af70-f56b0ecdc7d1",
"notificationEmail": null,
"createdAt": "2024-09-04T10:58:28.000Z",
"updatedAt": "2024-09-04T10:58:28.000Z",
"id": 1
}
}
See API documentation for more information