# HaloPSA & Better Stack integration

Create HaloPSA tickets from Better Stack incidents, send each one to the right HaloPSA client, and close it when the incident is resolved. The integration works with HaloPSA and HaloITSM.

## Create an API application in HaloPSA

1. In HaloPSA, go to **Configuration → Integrations → HaloPSA API**.
2. Copy the **Resource Server**, **Authorisation Server** and **Tenant**.
3. Click **View Applications** → **New**.
4. Set **Authentication Method** to **Client ID and Secret (Services)**.
5. Set **Login Type** to **Agent** and pick the agent tickets are created as.
6. On the **Permissions** tab, allow **read:tickets**, **edit:tickets** and **read:customers**.
7. Save the application and copy its **Client ID** and **Client Secret**.

## Connect HaloPSA to Better Stack

1. Go to **Integrations → [Exporting data](https://incidents.betterstack.com/team/0/integrations/exporting-data ";_blank")** and click **Add** on the **HaloPSA** card under **Project management**.
2. Paste the **Resource server URL**, **Authorisation server URL** and **Tenant** from HaloPSA. Leave **Tenant** empty if HaloPSA shows none.
3. Paste the **Client ID** and **Client secret** of the API application.
4. Click **Create HaloPSA integration**.
5. Under **Ticket defaults**, select the **Client**, **Site** and **Ticket type** for new tickets.
6. Click **Save changes**.

## Create a ticket from an incident

1. Open the incident and click **Create HaloPSA** in the header.
2. Review the **Summary** and **Details**, and click **Create ticket**.

The ticket number then shows in the incident header and links to the ticket in HaloPSA.

## Create tickets with an escalation policy

1. Go to [Escalation policies](https://incidents.betterstack.com/team/0/policies ";_blank") and open a policy.
2. In a step's **Who should we alert?**, add your HaloPSA integration. It's listed as **HaloPSA** followed by the integration's name.
3. Click **Save changes**.

When an incident reaches that step, Better Stack creates a ticket for it, unless the incident already has one.

[warning]
#### Does HaloPSA send new tickets to Better Stack?
Exclude tickets created by your Better Stack API application from what it sends, or each ticket opens a second incident. Keep `details_html` in what it sends too: each ticket links back to its incident there, and Better Stack creates no ticket for an incident that carries that link. HaloPSA's plain `details` field drops the link, so tickets and incidents would keep creating each other.
[/warning]

### Close tickets when the incident is resolved

When the incident is resolved, Better Stack adds a hidden note with a link to the incident to each ticket the escalation policy created. Select a **Close status** in your HaloPSA integration, for example **Closed**, to also close those tickets. Tickets created by hand are left as they are.

## Send tickets to the right client

Handling incidents for several clients? Name the client in an [incident metadata](https://betterstack.com/docs/uptime/incident-metadata/) key, such as `Company`, and Better Stack picks the HaloPSA client from it.

1. Open your HaloPSA integration from [Integrations](https://incidents.betterstack.com/team/0/integrations ";_blank")
2. Under **Clients by metadata**, set **Client from metadata keys** to `Company`.
3. Map each **Metadata value** whose name differs in HaloPSA to its **HaloPSA client**, for example `Acme` to **Acme Corporation**.
4. Click **Save changes**.

A value without a row goes to the HaloPSA client with the same name. Tickets go to the matched client's main site, and a value with no match goes to the client and site in **Ticket defaults**.

Your incidents name the client under different keys? List them separated by commas, such as `Company, Organisation`. The first key with a value on the incident decides, and a row matches a value from any of them. Keys are case-sensitive, values are not.

## Set the ticket priority

Pick the HaloPSA priority from an incident metadata key, such as `Severity`.

1. In your HaloPSA integration, under **Ticket priority**, set **Priority from metadata keys** to `Severity`.
2. Map each **Metadata value** to a **HaloPSA priority**, for example `critical` to **High**.
3. Click **Save changes**.

The priorities listed are those of your default ticket type's SLA. Without a matching row, HaloPSA applies the ticket type's default priority, and the incident's timeline says why.

## Need help?

Please let us know at hello@betterstack.com.  
We're happy to help! 🙏
