Skip to content

XoneWork Webhook

XoneWork Webhook is a start component: it starts the flow every time a XoneWork project sends an event by webhook, for example a task was created, changed column, got a comment or got new assignees, a timer was stopped or a sprint was completed. Each event is one run of the flow.

XoneWork signs every delivery with a secret. The component checks that signature and its age, so the flow only starts with deliveries that really come from your XoneWork and were not replayed later.

When to use it

  • React instantly when a task is created or changes, without waiting for the next check.
  • Start an agent as soon as a task reaches a column, also when someone drags it on the board.
  • Answer or act when someone comments on a task.
  • Send hours to another application every time a timer stops or time is logged.
  • Notify the team when a sprint is activated or completed.

If no token can manage the project’s webhooks and its owner cannot create it either, use XoneWork Trigger, which checks the board without any setup in XoneWork.

Configuration

XoneWork is the one that calls the flow, but you do not have to set anything up there: when you activate the trigger, NappAI creates the webhook in your XoneWork project, keeps its secret and uses it to check the signature of every delivery. When you deactivate it, NappAI deletes the webhook.

You need a XoneWork credential with the XoneWork address and an API token. See Credentials. The token’s person needs the webhooks_can_manage permission in the project, and the token must include it: tick it when you create the token in Account › API tokens.

FieldWhat it does
CredentialThe XoneWork credential. With it NappAI creates, updates and deletes the project’s webhook.
ProjectThe XoneWork project whose events start the flow. Choose it from the list, or write its key, its name or the address of one of its pages.
EventsThe events that start the flow. Default: task.created, task.updated and task.assigneesChanged. The webhook is created with these same events.
Ignore Comments Made Through the APIOn by default. Comments written by a flow or an agent through the API do not start the flow, so a flow that comments never triggers itself. Only people’s comments arrive as task.commentCreated.
Webhook Secret (advanced)Only for a webhook created by hand in XoneWork: the secret XoneWork shows once. Leave it empty when the trigger creates the webhook.
Max Signature Age (s) (advanced)300 by default. Rejects deliveries signed longer ago than these seconds, so nobody can replay an old delivery. 0 turns the check off.
Skip Repeated Deliveries (advanced)On by default. XoneWork may deliver the same event twice when it retries; the component recognises each delivery by its X-Webhook-Delivery header, so each event runs the flow once.
Run on Test Deliveries (advanced)Off by default. XoneWork’s test button sends webhook.test: it is accepted, but does not run the flow unless you turn this on.
DataUsed to test the component in the editor. When the flow runs from its webhook, it is filled with what was received. Leave it empty.

These are the events:

EventWhen it arrives
task.createdA task is created.
task.statusChangedA task changes column, also when someone drags it on the board. It carries the source and target columns.
task.commentCreatedSomeone comments on a task. It carries the comment and its author.
task.updatedA task changes. It carries the changes in changes.
task.deletedA task is deleted.
task.assigneesChangedThe people assigned to a task change.
task.assignedToSprintA task enters a sprint.
time-entry.started, time-entry.stoppedA timer starts or stops.
time-entry.created, time-entry.updated, time-entry.deletedA time entry is created, changed or deleted.
sprint.created, sprint.updated, sprint.deletedA sprint is created, changed or deleted.
sprint.activated, sprint.reviewStarted, sprint.completed, sprint.paused, sprint.resumedA sprint is activated, goes to review, is completed, paused or resumed.

Activate it

  1. Choose the XoneWork credential, the Project and the Events in the component.
  2. Deploy a version of the flow: deliveries run the deployed version. See Versions and publishing.
  3. Open the API Access window, go to the New items triggers tab and press Activate on the XoneWork Webhook card. You can also ask the assistant: “leave this flow’s triggers listening”.

When you activate it, NappAI creates the webhook in the project. You will see it in XoneWork, in Webhooks, pointing at an address of your flow that carries no API key. The card changes to Listening and shows when the last event arrived.

  • If you change the project or the events, the card changes to Out of sync: press Update and the webhook is updated without changing its secret.
  • If you deactivate the trigger, NappAI deletes the webhook from XoneWork.
  • If XoneWork turns the webhook off (it does after 10 failed deliveries in a row) or someone deletes it there, the card says so: press Update to turn it on or create it again.
  • If the token cannot manage the project’s webhooks, the activation says so. Create a token with webhooks_can_manage or ask the project’s owner.

Create the webhook by hand

Do this only if no token can manage the project’s webhooks. Leave Project empty and:

  1. Deploy the flow. Its address looks like this: <NappAI API address>/api/v1/webhook/<flow id>?x-api-key=<API key>. See API keys.
  2. The project’s owner creates the webhook in XoneWork, in Webhooks, with that address and the same events as in Events.
  3. XoneWork shows the secret only once. Paste it in Webhook Secret. Without a secret the signature is not checked.

How each delivery is checked

XoneWork signs every delivery with the X-Webhook-Signature-V2 header: sha256= followed by the HMAC-SHA256 of <timestamp>.<body> with the secret, where <timestamp> is the X-Webhook-Timestamp header. NappAI checks that signature and rejects deliveries signed longer ago than Max Signature Age (s), so an old delivery cannot be replayed. When a delivery does not carry that signature, it checks the older one, X-Webhook-Signature, which signs only the body. Every delivery carries its id in X-Webhook-Delivery, which is how repeated deliveries are recognised. When a delivery fails, XoneWork retries twice (after 10 and 20 seconds), and it turns the webhook off after 10 failures in a row.

Output

The Data output delivers the event with these fields:

  • event and timestamp: the event and when it happened. delivery_id: the delivery’s id.
  • task: the full task, when the event is about a task. Shortcuts: task_id, title, task_number (also number), parent_id (on a subtask, the task it belongs to), project_id, column_id, priority (low, medium or high) and completed.
  • changes: what changed, in task.updated.
  • from_column and to_column: the names of the source and target columns, in task.statusChanged, with their ids in from_column_id and to_column_id.
  • comment and comment_author: the comment’s text and who wrote it, in task.commentCreated, with its id in comment_id. initiator_kind says whether a person wrote it (user) or it came through the API.
  • assignee_ids: the assigned people.
  • initiator_id: who made the change.
  • sprint and sprint_id: the sprint, in sprint events.
  • entry: the time entry, in time events.

The fields come with XoneWork’s ids. To read the task with its key, its column by name and its people by email, connect XoneWork Tasks with Get Task and the task_id field in Task.

If an event not ticked in Events, a test, a repeated delivery or a comment made through the API with Ignore Comments Made Through the API on arrives, the flow stops at this component without an error. If the signature is not valid or is too old, the delivery is rejected.

Example

A company wants to send every time entry logged in XoneWork to its billing tool.

  1. Add XoneWork Webhook, choose the XoneWork credential and the Project, and tick time-entry.stopped and time-entry.created in Events.
  2. Connect Data to an agent or a component that reads the entry field and sends it to the billing application.
  3. Deploy the flow and activate the trigger in API Access: the webhook is created in XoneWork for you.

For an agent that answers the comments on tasks, tick task.commentCreated in Events, keep Ignore Comments Made Through the API on and pass comment and task_id to the agent: the comments the agent itself writes with XoneWork Comments do not start the flow again.

Good practices

  • Let the trigger create the webhook: the address carries no API key and every delivery is checked by its signature.
  • Tick only the events you will use.
  • After changing the project or the events, deploy and press Update on the trigger’s card.
  • Keep Skip Repeated Deliveries on: XoneWork’s retries may deliver the same event twice.
  • Keep Ignore Comments Made Through the API on if the flow comments on tasks: that way it does not start with its own comments.
  • A flow can have only one webhook component.

Security and limitations

  • Creating the webhook needs the webhooks_can_manage permission in the project, for the person and in the token.
  • XoneWork turns the webhook off after 10 failures in a row. The trigger’s card warns about it and Update turns it on again.
  • The secret of the webhook the trigger creates is stored encrypted and is never shown.
  • If you delete the flow without deactivating the trigger first, the webhook stays in XoneWork: its deliveries are rejected and XoneWork turns it off by itself. You can delete it there.
  • There is one webhook per flow: the trigger uses the first XoneWork Webhook of the flow.