You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+75
Original file line number
Diff line number
Diff line change
@@ -231,6 +231,81 @@ A work time can have the following states:
231
231
232
232
* The `workTypeId` refers to the `workTypes` that can be accessed from the company settings.
233
233
234
+
## Webhooks
235
+
Webhooks allow you to receive real-time notifications when events occur in your Craftnote account. When an event happens, Craftnote sends an HTTP POST request to the URL you've configured for your webhook.
236
+
237
+
### Webhook Payload Structure
238
+
When an event occurs, Craftnote sends a JSON payload to your webhook URL with the following structure:
239
+
240
+
```json
241
+
{
242
+
"event": "resource.action",
243
+
"timestamp": 1741172456,
244
+
"action": "created",
245
+
"resourceId": "resource-type/resource-id",
246
+
"fieldPath": "$",
247
+
"data": {
248
+
// The complete resource data
249
+
},
250
+
"previousData": null
251
+
}
252
+
```
253
+
254
+
-`event`: A string in the format "resource.action" that identifies what happened
255
+
-`timestamp`: Unix timestamp (seconds since epoch) when the event occurred
256
+
-`action`: The type of action that triggered the event (currently only "created" is supported)
257
+
-`resourceId`: A string identifying the resource that was affected, in the format "resource-type/id"
258
+
-`fieldPath`: Path to the field that was changed ($ represents the entire resource)
259
+
-`data`: The complete current state of the resource
260
+
-`previousData`: The previous state of the resource (null for creation events)
261
+
262
+
### Supported Events
263
+
Currently, only creation events are supported for the following resources:
264
+
265
+
#### Project Events
266
+
-`project.created`: Triggered when a new project is created
267
+
268
+
#### Task Events
269
+
-`task.created`: Triggered when a new task is created
270
+
271
+
#### Chat Message Events
272
+
-`message.created`: Triggered when a new chat message is posted
273
+
274
+
#### Time Tracking Events
275
+
-`trackedTime.created`: Triggered when a new time entry is created
276
+
277
+
#### File Events
278
+
-`file.created`: Triggered when a new file is uploaded
279
+
280
+
### Example Webhook Payload
281
+
Here's an example of a webhook payload for a task creation event:
0 commit comments