> For the complete documentation index, see [llms.txt](https://docs.harmony.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.harmony.io/service-desk-and-tickets/ticket-events-and-webhooks.md).

# Ticket Events and Webhooks

Harmony's service desk can emit real-time events whenever a support ticket is created or updated. By subscribing to these events through webhooks, you can connect external tools and services directly to your ticket workflow - eliminating the need to poll the API for changes.

Common use cases include:

* Syncing ticket data with a CRM or customer success platform
* Triggering automated workflows when a ticket is opened or its status changes
* Feeding ticket activity into analytics platforms or custom dashboards
* Notifying downstream systems in real time as support interactions progress

### How Ticket Events Work

When a ticket is created or updated in the Harmony service desk, Harmony generates an event and delivers it as an HTTP POST request to the webhook endpoint URL you configure. Each request contains a JSON payload describing the event and the current state of the ticket.

Events are emitted for the following activity:

* **Ticket created** - a new support ticket is opened in the service desk
* **Ticket updated** - any field on an existing ticket changes, including status, priority, assignee, or custom fields

### Configuring a Webhook Endpoint

To receive ticket events, you need to register a webhook endpoint that Harmony can send requests to.

1. Navigate to **Settings** and open the **Integrations** section.
2. Select **Webhooks** and click **Add Webhook**.
3. Enter the URL of your endpoint in the **Endpoint URL** field. The URL must be publicly accessible and accept HTTPS requests.
4. Under **Event Types**, select **Ticket Created**, **Ticket Updated**, or both, depending on which events you want to receive.
5. Click **Save** to activate the webhook.

Harmony immediately begins sending events to the configured endpoint once you save.

### Event Payload Structure

Each webhook request contains a JSON body with information about the event and the affected ticket. The payload follows this general structure:

```json
{
  "event": "ticket.created",
  "timestamp": "2024-06-10T14:32:00Z",
  "ticket": {
    "id": "ticket_abc123",
    "subject": "Login issue after password reset",
    "status": "open",
    "priority": "high",
    "assignee": "agent@example.com",
    "requester": "user@example.com",
    "created_at": "2024-06-10T14:32:00Z",
    "updated_at": "2024-06-10T14:32:00Z",
    "custom_fields": {}
  }
}
```

The `event` field will be either `ticket.created` or `ticket.updated`. The `ticket` object reflects the full current state of the ticket at the time the event was generated.

### Responding to Webhook Requests

Your endpoint must return an HTTP `2xx` status code to acknowledge receipt of the event. Harmony treats any other response code as a delivery failure.

If delivery fails, Harmony retries the request using an exponential back-off strategy. After a defined number of consecutive failures, the webhook may be automatically disabled and you will be notified so you can investigate and re-enable it.

Keep your endpoint response time short. Process the event asynchronously if your integration requires heavy computation, and return the `200 OK` acknowledgment immediately.

### Securing Your Webhook Endpoint

Harmony signs each webhook request so you can verify that it genuinely originated from Harmony and has not been tampered with in transit.

* A signature is included in the `X-Harmony-Signature` request header.
* The signature is an HMAC-SHA256 hash of the raw request body, computed using the secret key displayed when you create the webhook.
* Store the secret key securely and recompute the signature on your server when you receive a request. Only process the payload if the signatures match.

You can rotate the secret key at any time from the webhook settings page. After rotating, update your endpoint to use the new key.

### Testing Your Integration

Before going live, use the **Send Test Event** option in the webhook settings to deliver a sample payload to your endpoint. This lets you verify that your endpoint is reachable, correctly parses the payload, and returns a successful response - without waiting for real ticket activity.

You can also review recent delivery attempts and their response codes in the **Delivery Logs** tab of the webhook settings page to help debug any issues.

### Disabling or Deleting a Webhook

* To temporarily stop event delivery without losing your configuration, toggle the webhook to **Inactive** in the webhook settings.
* To permanently remove a webhook, click **Delete**. Delivery stops immediately and the configuration is removed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.harmony.io/service-desk-and-tickets/ticket-events-and-webhooks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
