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

# Webhooks

> Send CSAT responses, ticket changes and company changes to your own systems as they happen, as signed JSON requests to up to ten HTTPS endpoints.

> [!WARNING]
>
> **Beta feature, by approval only.** Webhooks are not available to every MSP yet. To request access, contact [support@msportal.ai](mailto:support@msportal.ai).

Use **Webhooks**, on the **Developer Access** tab of **Settings > Integrations**, to have MSPortal send an HTTPS `POST` to your own system each time something you care about happens: a client rates a ticket, a ticket is opened or changes, a company is added, changed or removed. Your system no longer has to poll the API to notice. This page is for MSP staff.

## Before you start

* You need read access to **Webhooks** settings to see the page, its delivery log and an endpoint's signing secret. Adding, editing, pausing, testing, resending and rotating secrets needs write access. Deleting an endpoint needs manage access.
* Each MSP can have up to **10 endpoints**.
* An endpoint acts as the person who created it, its **owner**, the same way an API key acts as its user. It only receives events and fields its owner could read through the [public API](https://docs.msportal.ai/api-reference): a CSAT response needs **CSAT** access, ticket events need **Tickets** read access and a connected PSA, company events need **Companies** settings read access. If the owner loses that access, those events are skipped. If the owner can no longer sign in, or is no longer MSP staff, the endpoint pauses and its alert recipients are emailed; whoever resumes it becomes its owner. Whoever changes an endpoint's URL, events, fields or companies also becomes its owner, so they need access to every event it keeps.
* The receiving URL must start with `https://` and be reachable from the public internet. Private, internal and loopback addresses are refused, and redirects are not followed.

## Add an endpoint

**1. Open Webhooks**

Go to **Settings > Integrations**, open the **Developer Access** tab and select **Manage Webhooks** on the **Webhooks** card. Then select **Add endpoint**.

**2. Enter the URL and choose companies**

Enter the **Endpoint URL** and an optional **Description**. Under **Companies**, leave **All companies**, or choose **Specific companies** to send only events about them.

**3. Choose events and the fields each sends**

Under **Events**, choose what to send from the list. Events your role cannot read are not offered. Under **Payload fields**, each chosen event starts with all of its fields. To send less, open an event and untick what your system does not need, or select **Only required** and tick what it does; **Select all** puts every field back. The record's ID and its company are always sent.

**4. Choose a secret header and alert recipients**

If your receiving tool can only compare a header value and cannot check a signature, such as Power Automate, Rewst or n8n, enter a **Secret header** name, such as `x-msportal-secret`: every request then also carries the signing secret in that header. **Alert recipients** are emailed when deliveries keep failing; leave it empty to alert the owner.

**5. Copy the signing secret**

Select **Add endpoint**. MSPortal shows the endpoint's **signing secret**. Store it where your receiving system can read it, and use it to [verify every request](#verify-a-request). Anyone with read access can reveal it again later from the endpoint's menu.

**6. Send a test event**

In the endpoint's menu, select **Send test event**. Your system receives a `webhook.test` event, and the **Deliveries** tab shows how it answered.

## Events

| Event | Sent when | `data.object` |
| - | - | - |
| `csat.response.created` | A client rates a ticket, in MSPortal or in a connected CSAT tool | The rating: score, scale, comment, company, contact, technician and the rated ticket, as [List CSAT responses](https://docs.msportal.ai/api-reference) returns it |
| `ticket.created` | A ticket is opened in the connected PSA | The ticket |
| `ticket.updated` | A ticket's status, priority, escalation, assignee, contact (name, email or phone), board, title, company, type, category, issue type, sub-issue type or due date changes, including when it closes | The ticket |
| `company.created` | A company is added | The company |
| `company.updated` | A company's name, active state, domain, website, industry, size, account number, phone, address, primary contact, parent company, type, territory, market or time zone changes | The company |
| `company.deleted` | A company is removed | What the company held when it was removed: name, active state, domain, website, industry, size, account number and phone |
| `webhook.test` | You select **Send test event** | `{ "message", "endpointId" }` |

Payloads carry names and values, not just IDs. A ticket includes its number, title, description, status, priority, escalation status, company, contact name, email and phone, who reported and entered it, the assigned technician, board, type, category, issue and sub-issue type, source, hours, dates (created, updated, due, closed) and links to the ticket in your PSA (`psaUrl`; for Autotask it opens through MSPortal, for staff with Tickets read access) and in MSPortal (`portalUrl`). A company includes its address, phone, primary contact, account number, PSA type, territory, market, time zone, parent company, custom fields and the team assigned to it, such as its vCIO. The [API reference](https://docs.msportal.ai/api-reference) lists every field of each event; the **Payload fields** section of an endpoint chooses which it sends.

Events about the demo company are never sent. Several changes to the same record within about a minute are sent as one `updated` event, with every changed field in `changedFields`, and what each held before in `previousValues` (for the fields the endpoint receives). A ticket that moved to another company sends no `previousValues`, because its earlier values belong to the other company. Ratings submitted more than seven days ago and tickets opened more than a day ago, such as the history an integration imports when it first connects, are not sent as new.

## What a request looks like

To see what an endpoint receives, open its menu and select **Example payload**. For each event the endpoint subscribes to, it shows the exact headers and JSON body of a request, with the fields the endpoint sends, filled with made-up records, and a **Copy** button. The example is signed with the example secret shown beneath it, so you can test your signature check against it.

Every event is a separate `POST` with a JSON body:

```json theme={null}
{
  "id": "3f2c1a8e-6b0d-4c1e-9a77-1d2e3f4a5b6c",
  "type": "ticket.updated",
  "occurredAt": "2026-11-28T15:04:05.000Z",
  "tenantId": "9c4f5da0-0000-4000-8000-000000000000",
  "apiVersion": "2026-11-28",
  "data": {
    "object": { "id": "12345", "title": "Printer offline", "status": "Closed", "isClosed": true, "companyId": "3f6a1c2e-8b4d-4e7a-9c15-2d8e6b0a4f11", "companyName": "Contoso Ltd" },
    "changedFields": ["isClosed", "status"],
    "previousValues": { "isClosed": false, "status": "In Progress" }
  }
}
```

The headers follow the [Standard Webhooks](https://www.standardwebhooks.com) specification:

| Header | Value |
| - | - |
| `webhook-id` | The event's `id`. The same on every retry and resend: use it to drop repeats. |
| `webhook-timestamp` | When this attempt was sent, in Unix seconds |
| `webhook-signature` | `v1,` followed by the signature. During a [secret rotation](#rotate-the-signing-secret) it holds two, separated by a space |
| `X-MSPortal-Event` | The event type |
| Your **Secret header**, if the endpoint has one | The signing secret, as is. Check it only if your tool cannot verify `webhook-signature`: anyone who sees a request's headers sees the secret. |

Events can arrive out of order. Compare the object's `updatedAt` before you overwrite newer data.

## Verify a request

The signature is an HMAC-SHA256 of `webhook-id`, `webhook-timestamp` and the raw body joined by `.`, keyed with the base64-decoded part of the secret after `whsec_`. Any Standard Webhooks library verifies it. Without one:

```javascript Node.js theme={null}
import crypto from "node:crypto";

export function verify(headers, rawBody, secret) {
  const id = headers["webhook-id"];
  const timestamp = headers["webhook-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = crypto
    .createHmac("sha256", key)
    .update(`${id}.${timestamp}.${rawBody}`)
    .digest("base64");
  return headers["webhook-signature"]
    .split(" ")
    .some((signature) => {
      const given = Buffer.from(signature.replace(/^v1,/, ""));
      const wanted = Buffer.from(expected);
      return given.length === wanted.length && crypto.timingSafeEqual(given, wanted);
    });
}
```

```python Python theme={null}
import base64, hashlib, hmac, time

def verify(headers, raw_body: bytes, secret: str) -> bool:
    msg_id = headers["webhook-id"]
    timestamp = headers["webhook-timestamp"]
    if abs(time.time() - int(timestamp)) > 300:
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    signed = f"{msg_id}.{timestamp}.".encode() + raw_body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
    return any(
        hmac.compare_digest(sig.removeprefix("v1,"), expected)
        for sig in headers["webhook-signature"].split(" ")
    )
```

Verify against the raw body exactly as received, before parsing it.

## Answer, retries and failures

* Answer with any `2xx` status within **10 seconds**. Do slow work after you answer.
* A timeout, a connection error, `408`, `425`, `429` or a `5xx` is retried after 1 minute, 5 minutes, 15 minutes, 1 hour, 3 hours, 6 hours, 12 hours and 24 hours: nine attempts over about two days.
* Any other `4xx`, or a redirect, fails at once.
* `410 Gone` turns the endpoint off: use it when the receiving URL is retired.
* Before every attempt, MSPortal checks again that the owner can still read the event and that it is still about the endpoint's companies; if not, the delivery is skipped.
* When a delivery runs out of attempts, the alert recipients get an email, at most once a day per endpoint. If every delivery has failed for three days, with at least 20 failed, MSPortal turns the endpoint off and emails them again.
* Each endpoint takes up to **1,000 events an hour**. Past that, events are not sent and the endpoint shows **Hourly limit reached**; use the [public API](https://docs.msportal.ai/api-reference) to catch up.

## Deliveries

The **Deliveries** tab lists every request for 90 days: its event, status, the receiver's HTTP status, attempts and the next attempt. Filter it by endpoint, status, event or date, and open a delivery to see the last error and, for the person whose access built it (the endpoint's owner at the time), the request body (kept for 30 days) and the start of the receiver's answer. Other readers see the delivery without them, because the body holds what that person's access can read. That person sees them only while they can still read the event's record: once they lose access to it, or use an API key or MCP connection without its read scope, the body and answer are hidden too.

* **Resend** sends a finished delivery from the last 30 days again with the same `webhook-id`, built from the record as it is now.
* **Resend failed**, with the list filtered to one endpoint, sends again every delivery of that endpoint that failed in the last three days.
* To start again after an endpoint was turned off, fix the receiver, select **Resume** in the endpoint's menu, then **Resend failed**.

## Pause, edit or delete

From an endpoint's menu:

* **Pause** stops sending; events that happen while it is paused are not sent later. **Resume** starts again.
* **Edit** changes the URL, events, companies, description, secret header or alert recipients. Changing the URL, events or companies makes you the owner; deliveries still waiting are then built with your access. An event you cannot read can be removed, not added.
* **Delete** removes the endpoint and its signing secret.

## Rotate the signing secret

Select **Rotate secret** to get a new secret. For the next 24 hours, every request carries two signatures, one per secret, so your receiver keeps working while you replace the old one. A **Secret header** carries the new secret from the next request on, so update a header check right away.

## Manage webhooks with the API or MCP

Endpoints can also be managed through the [public API](https://docs.msportal.ai/api-reference) (`/webhooks`, with the `webhooks.read`, `webhooks.write` and `webhooks.delete` scopes) and the [MCP server](https://docs.msportal.ai/user-guides/mcp-server/index.md). Both take `fields`, the payload fields by event type, such as `{"ticket.updated": ["title", "status", "assignedTo"]}`; an event left out sends all of its fields, and on an edit `null` puts an event back on them. `secretHeader` names the secret header; on an edit, `null` removes it. An API key or MCP connection can only subscribe an endpoint to events whose read scope it also holds, such as `tickets.read` for ticket events. CSAT events need `tickets.read` as well as `surveys.read`, because their payload includes the rated ticket. A change to an endpoint's URL or companies is refused if someone changed its events at the same moment; load it again and retry.


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