Document toolboxDocument toolbox

To learn more about Tempo products, please visit our Help Center. For support, see our Support Portal.

Add worklog description and time spent as comment to the issue

Sometimes it can be helpful to add the description of worklogs as comments to issues. This gives users who have no permission to view the worklogs of others the option to see what work others have done. With this automation, users do not need to write a separate comment with information about what has been done on the issue.

Automation Trigger

For this automation, we select the “Work logged” trigger and select the “Created” and “Updated” option.
Even though the worklog is logged via the Tempo Log Time dialog, the Jira worklog event will get fired.

Jira Worklog Comment


Making the REST call to get the Tempo worklog ID

As the worklog description is obfuscated when the worklog is synced to Jira (https://tempo-io.atlassian.net/wiki/spaces/KB/pages/488931333 ), it will need to be retrieved from Tempo via a Tempo REST API call.

First, you need to get Tempo worklog ID from Jira worklog properties. In the web request, you need to use smart values for Jira issue id {{issue.id}} and Jira worklog id {{worklog.id}}.

Get Jira Worklog
https://YOUR_JIRA.atlassian.net/rest/api/3/issue/{{issue.id}}/worklog/{{worklog.id}}?expand=properties

(see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-group-issue-worklogs for information about this Jira Cloud REST API)

The response should be something like this:

{ "self": "https://cops.atlassian.net/rest/api/3/issue/12868/worklog/23076", "author": { "self": "https://cops.atlassian.net/rest/api/3/user?accountId=557058:295406f3-xxxx-xxxx-xxxx-dd15d021bd79", "accountId": "557058:295406f3-xxxx-xxxx-xxxx-dd15d021bd79", "avatarUrls": { "48x48": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png", "24x24": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png", "16x16": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png", "32x32": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png" }, "displayName": "Tempo Timesheets", "active": true, "timeZone": "America/Montreal", "accountType": "app" }, "updateAuthor": { "self": "https://cops.atlassian.net/rest/api/3/user?accountId=557058:295406f3-xxxx-xxxx-xxxx-dd15d021bd79", "accountId": "557058:295406f3-xxxx-xxxx-xxxx-dd15d021bd79", "avatarUrls": { "48x48": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png", "24x24": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png", "16x16": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png", "32x32": "https://secure.gravatar.com/avatar/182fc208a1a2e6cc41393ab6c9363d9c?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTT-6.png" }, "displayName": "Tempo Timesheets", "active": true, "timeZone": "America/Montreal", "accountType": "app" }, "comment": { "version": 1, "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "time-tracking" } ] } ] }, "created": "2022-03-28T15:57:11.215-0400", "updated": "2022-04-05T15:07:02.492-0400", "started": "2022-03-02T03:00:00.000-0500", "timeSpent": "2h", "timeSpentSeconds": 7200, "id": "23076", "issueId": "12868", "properties": [ { "key": "tempo", "value": { "shadow": "true", "tempo_id": 9701 } } ] }

Then, you need to store the Tempo worklog id (tempo_id) in a variable {{TempoWorklogId}}:

{{webhookResponse.body.properties.value.tempo_id}}

Making the REST call to get the Tempo worklog details

Second, you can get Tempo Worklog details with Tempo REST API. The Authorization to retrieve the worklog data needs to be done via the Tempo API Integration token (Bearer token).
Please make sure to check the
”Delay execution of subsequent rule actions until we've received a response for this web request” option.

You can get Tempo worklog with the variable {{TempoWorklogId}}:

Payload should look like this:

Adding the comment to the issue

In the last step, the worklog description that was retrieved from Tempo and the time logged (in minutes) are added as a comment to the issue.
To make sure that a new comment for each worklog is added, please make sure that the option to
”Prevent duplicates by only adding this comment once to a particular issue.” is unchecked.