Worklog Webhook in BoldDesk
By creating a webhook, the worklog fields can be sent as payload to an API or an HTTP request-catching application in real-time. This article provides an overview of how to set up and use worklog webhooks for efficient data transfer.
Setting-Up Worklog Webhooks
A worklog webhook can be triggered based on worklog events in the tickets and activities modules. To learn more about worklog events captured by webhook, explore Webhook Payloads, Headers, and Event.
Worklog Payload
When creating a webhook, there are two payload options available:
-
Default - Sends the worklog fields in a predefined structure.
-
Advanced - Allows for customization of the payload structure, which is often framed in JSON format.
To learn more about webhook creation and its features, explore How to Create and Manage Webhooks in BoldDesk Tickets.
Worklog fields that are available to choose from the default and advanced options are as follows:
| S. No | Default fields | Properties | Placeholders in Advanced option |
|---|---|---|---|
| 1. | Activity ID | - | {{worklog.ActivityId}} |
| 2. | Brand | ID, Name |
{{worklog.Brand.Id}} {{worklog.Brand.Name}} |
| 3. | Created By | User ID, Email ID |
{{worklog.CreatedBy.UserId}} {{worklog.CreatedBy.EmailId}} |
| 4. | Created Time | - | {{worklog.CreatedOn}} |
| 5. | Description | - | {{worklog.Description}} |
| 6. | Is Billable | - | {{worklog.IsBillable}} |
| 7. | Last Modified By | User ID, Email ID |
{{worklog.LastModifiedBy.UserId}} {{worklog.LastModifiedBy.EmailId}} |
| 8. | Last Modified Time | - | {{worklog.LastModifiedOn}} |
| 9. | Module ID | - | {{worklog.ModuleId}} |
| 10. | Time Spent | - | {{worklog.TimeSpent}} |
| 11. | Ticket ID | - | {{worklog.TicketId}} |
| 12. | Work Log Date | - | {{worklog.WorkLogDate}} |
| 13. | Work Log ID | - | {{worklog.Id}} |
- The Activity ID has a value only when worklog events are triggered in the Activities module; otherwise, it is null.
- The Ticket ID & Brand have a value only when worklog events are triggered in the Tickets module; otherwise, they are null.
- The Time Spent field is represented in minutes.
- All date and time fields are in the UTC zone.
Trigger Worklog Webhook Conditionally
| S. No | Condition | Operator | Value | Description |
|---|---|---|---|---|
| 1. | Module | Is In |
Ticket Activity |
To differentiate worklogs from the tickets and activities module. |
Sample Payload
Default Option
When all fields are included, the payload sent for a Created event might resemble the below,
{
"eventModule": "WorkLog",
"eventType": "WorkLogCreated",
"eventTime": "2024-01-11T09:18:40.5534259Z",
"orgId": 1,
"orgName": "Phoenix Solutions",
"payload": {
"id": 1011,
"workLogDate": "2024-01-11T09:18:40.5534259Z",
"timeSpent": 60,
"ticketId": 10119,
"moduleId": 1,
"lastModifiedOn": "2024-01-11T09:18:40.5534259Z",
"lastModifiedBy": {
"userId": 132,
"emailId": "[email protected]"
},
"description": "<p><span style=\"background-color: unset; color: var(--color-sf-text-primary); text-align: inherit;\">Work done:</span></p><p><span style=\"background-color: unset; color: var(--color-sf-text-primary); text-align: inherit;\">Collaborated with the development team to plan new features for our flagship product. </span></p><p><span style=\"background-color: unset; color: var(--color-sf-text-primary); text-align: inherit;\">Conducted thorough code reviews, resolved merge conflicts, and optimized database queries for improved performance.</span></p>",
"createdOn": "2024-01-11T09:18:40.5534259Z",
"createdBy": {
"userId": 132,
"emailId": "[email protected]"
},
"brand": {
"id": 2,
"name": "Flagship-Product"
},
"isBillable": true,
"activityId": null
}
}
Advanced Option
The Custom Payload text area available under the advanced option lets you input your customized payload and insert preferred worklog data from the placeholder section. This section appears when you click on Insert Placeholders.
Troubleshooting Worklog Webhooks
Some fields are null in the webhook payload
- If
activityIdisnull, verify whether the worklog event originated from the Tickets module (expectednull). - If
ticketIdorbrandisnull, verify whether the worklog event originated from the Activities module (expectednull).
Time calculations look incorrect in the receiving system
timeSpentis sent in minutes. Confirm that the receiving endpoint does not assume hours or seconds.
Timestamps look shifted
- Worklog webhook date/time fields are sent in UTC. Confirm that the receiving endpoint converts UTC to the required local timezone.
FAQs
1) What is the difference between the Default payload option and the Advanced payload option?
The Default payload option sends worklog fields in a predefined structure. The Advanced payload option lets an admin define a custom payload format (commonly JSON) and insert worklog values using placeholders such as {{worklog.Id}} and {{worklog.TimeSpent}}.
2) Which modules can trigger a worklog webhook?
Worklog webhooks can be triggered by worklog events from the Tickets module and the Activities module.
3) Why is activityId sometimes null in the payload?
activityId has a value only when the worklog event occurs in the Activities module. When the worklog event occurs in the Tickets module, activityId is null.
4) Why are ticketId and brand sometimes null in the payload?
ticketId and brand have values only when the worklog event occurs in the Tickets module. When the worklog event occurs in the Activities module, ticketId and brand are null.
5) What unit does the timeSpent field use?
timeSpent is represented in minutes.
6) What timezone do the worklog webhook date/time fields use?
All date and time fields in the worklog webhook payload are sent in UTC.
7) Where can an admin find the list of worklog webhook events and the common event envelope fields?
See Webhook Payloads, Headers, and Event for the event list and shared webhook envelope details (headers, event names, and overall structure).