> ## Documentation Index
> Fetch the complete documentation index at: https://kb.mspprocess.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PSA ticket automation (Hawk)

> Watch your HaloPSA, ConnectWise PSA or Autotask tickets and start a Studio workflow when a ticket matches a condition.

Hawk checks your PSA every minute for new tickets (with ConnectWise PSA and Autotask, updated ones too) and starts the workflows linked to a watcher whenever a ticket matches its condition.

<video controls preload="none" playsInline poster="/images/videos/studio-hawk.jpg" src="https://mintcdn.com/triggr/GxrCQFDFNLmEMyJ1/images/videos/studio-hawk.mp4?fit=max&auto=format&n=GxrCQFDFNLmEMyJ1&q=85&s=44fcc03194e1729eeaefd7d43be7fa5e" />

PSA ticket automation: switch Hawk on, test a password reset watcher on imported HaloPSA tickets, link the workflow it starts and read its logs (1:27).

You need View Hawk to open Settings > Hawk and Edit Hawk to change it, and your PSA's Base Configuration connected: [HaloPSA](https://kb.mspprocess.com/integrations/halopsa.md), [ConnectWise PSA](https://kb.mspprocess.com/integrations/connectwise-psa.md) or [Autotask](https://kb.mspprocess.com/integrations/autotask.md).

## Turn on Hawk

**1. Set your PSA**

If the status card shows **Set Default PSA**, click it and choose your PSA (the org-wide Default PSA that ticket steps also use). Once it's set, the card shows your PSA instead.

![The Hawk page with a Disabled status, a yellow Set Default PSA button, Test Connection and Enable buttons, and a Hawk is disabled panel with an Enable Hawk button.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-disabled.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=3b6499b14c33dce6d36fd02eced1060d)

![The Set Default PSA dialog offering ConnectWise Manage, HaloPSA and Autotask, with a Cancel button.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/set-default-psa.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=2447c52a6745bec6d880fba7b3dbe329)

**2. Test the connection**

Click **Test Connection**. Connection Test Failed shows the PSA's error.

![The Connection Test Successful dialog for HaloPSA showing 5 tickets fetched and a Sample Tickets table with ID, Summary, Client, Contact and Created columns.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-test-connection.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=085aa2cf61783a6cc3c3680dd48fb6e4)

**3. Enable Hawk**

Click **Enable**. Hawk picks up tickets created from now on; with ConnectWise PSA and Autotask, tickets updated from now on too.

**4. Import some history (optional)**

Click **Import History**, choose a Time Period and click Import Tickets. Imported tickets are for Run Preview only; they never start workflows, even when they change later.

![The Import Historical Tickets dialog explaining that imported tickets will not trigger any watchers, with Time Period set to 24 hours and Cancel and Import Tickets buttons.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-import-history.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=e32d3833a5d9800980304fc92c88a03d)

## Create a watcher

This example starts a workflow for every new ticket that asks for a password reset.

**1. Write the condition**

Click **New Watcher**, type a JavaScript condition and click Run Preview; Matching should list the tickets you expect. Click a field under Ticket Fields, or a line of the Selected Ticket Payload, to insert it.

```js theme={null}
_.includes(_.toLower(ticket.summary), "password reset")
```

![The New Watcher editor: a Reference panel listing HaloPSA ticket fields and helper functions, a Condition (JavaScript) editor checking whether the lower-cased summary includes password reset, a Live Preview with Matching (2), Not Matching (3) and All (5) tabs and the selected ticket's payload, and Name and Description fields with a Create Watcher button.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-watcher-editor.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=32a05e77c3401eaff3babc17d7d71ca2)

**2. Name it and save**

Enter a unique **Name** and click **Create Watcher**.

**3. Link a workflow**

Click the link icon (**Link Workflows**) on the watcher's row, then + next to each workflow it should start. Links save straight away.

![The Link Workflows dialog for the Password reset requests watcher with one linked workflow and an Add Workflow search listing workflows with plus buttons, and a Done button.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-link-workflows.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=f0a41849a974cccbe73e65ec44619ade)

**4. Turn the watcher on**

New watchers start Disabled: click the play icon (**Enable Watcher**) on its row.

![The Hawk page showing Enabled with HaloPSA, Last poll: Just now, Test Connection and Disable buttons, the Watchers, Tickets and Analysis tabs, and the Password reset requests watcher with 1 workflow, Enabled status and edit, logs, link, pause and delete icons.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-watchers.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=ce0bb89fc793a59e13b12d402f238e82)

## Write conditions

A condition is one JavaScript expression that's true for tickets to act on. `ticket` is the ticket as your PSA returns it, so field names differ by PSA: copy them from Ticket Fields or from a ticket's Ticket Payload on Tickets.

```js theme={null}
// HaloPSA: one client
ticket.client_name === "Acme Corp"

// ConnectWise PSA: new tickets on one board that mention a password reset
_.get(ticket, "board.name") === "Service Desk" &&
  _.get(ticket, "status.name") === "New" &&
  _.includes(_.toLower(ticket.summary), "password reset")

// Autotask: several keywords in the title
/password|locked out|unlock/i.test(ticket.title || "")
```

Helpers: `_.get(obj, path, default)`, `_.includes`, `_.isEmpty`, `_.toLower` and `_.toUpper`. Prefer them to `ticket.summary.toLowerCase()`, which fails when the field is missing. A condition can't see your Triggr clients; check the client in the workflow.

## What the workflow receives

Each linked workflow starts once per matching ticket, even when Inactive (unlink it or disable the watcher to stop it), with:

* `ctx.params`: the whole ticket, such as `{{ ctx.params.summary }}`.
* `ctx.metadata`: `source` (`hawk`), `watcherId`, `watcherName`, `psaType`, `psaTicketId` and `hawkTicketId`.

The run has no client. Start with **Search For Client** (Property: Variable) on your PSA's mapping variable and the ticket's client ID field, then Set Client By ID with the client it finds:

| PSA | Variable Name | Value |
| - | - | - |
| HaloPSA | `haloId` | `{{ ctx.params.client_id }}` |
| ConnectWise PSA | `connectwiseId` | `{{ ctx.params.company.id }}` |
| Autotask | `autotaskId` | `{{ ctx.params.companyID }}` |

Check the client ID field against a ticket's Ticket Payload on Tickets, and add a Condition after the search so tickets from unmapped clients finish cleanly. For other ways to start workflows, see [Triggers](https://kb.mspprocess.com/studio/workflows/triggers.md).

## Check what happened

Click the document icon (**View Logs**) on a watcher: each ticket shows Matched, Not Matched or Error, and the IDs of the runs it started, which you find on Executions.

![The Watcher Logs dialog for Password reset requests listing five tickets with Matched or Not Matched status and 1 or 0 workflows triggered, with the first row expanded to show a workflow execution ID.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-watcher-logs.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=68cf5a27c8f33fdfed5b8aadb8ad43a1)

Tickets lists the tickets Hawk has stored; click one for its Ticket Payload.

![A HaloPSA ticket, #48217 Password reset for Sam Taylor, showing its Ticket Payload JSON including id, summary, details, status\_id, client\_id 12 and client\_name Acme Corp.](https://mintcdn.com/triggr/_d7ojda9vf8IHE31/images/studio/automation/hawk-ticket-payload.png?fit=max\&auto=format\&n=_d7ojda9vf8IHE31\&q=85\&s=9bd630b4c6a154e19b7d37797d40c47f)

Analysis shows automation ideas from your ticket history, run by the Triggr team on request; you Accept, Dismiss or Mark Implemented each recommendation.

## FAQ

> [accordion] organisation must have defaultPSA set to 'connectwise', 'halo', or 'autotask'
>
> Click Set Default PSA, choose your PSA, then click Enable again.

> [accordion] “Halo integration is missing required configuration” (or ConnectWise or Autotask)
>
> Fill in every field of the PSA's Base Configuration, then click Test Connection.

> [accordion] My watcher matches in the preview but never starts the workflow
>
> The watcher must be Enabled with a linked workflow, and Hawk only judges tickets that arrive while it is. Imported tickets never start workflows.

> [accordion] A ticket was edited to match later, but nothing ran
>
> Each watcher judges each ticket once, so match tickets as they look when first logged.

> [accordion] Hawk switched itself off
>
> Hawk turns off after 10 failed checks in a row (the status card shows the last error) or when the Default PSA changes. Fix the cause, check it with Test Connection, then click Enable; it picks up where it left off.

> [accordion] “condition timed out after 5 seconds” or “failed to evaluate condition”
>
> The ticket counts as not matched and its log shows Error. Use `_.get` and `_.toLower` for fields that may be missing, and avoid loops.

> [accordion] How long does Hawk keep tickets?
>
> Seven days after it last fetched them, with their watcher logs.

> [accordion] Is Settings > Tickets part of Hawk?
>
> No. Settings > Tickets sets the email address for the support ticket Triggr raises when a workflow fails.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.