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

# Zendesk Support

> Client-mode REST API connector for a curated Zendesk Support Ticketing API v2 slice: create tickets from alarms, update with resolution, list and add comments

Technical Preview

## Overview

A client-mode connector for a **curated Support / ticketing** slice of the [Zendesk Support Ticketing API](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/) under `https://YOUR_SUBDOMAIN.zendesk.com/api/v2/`:

| Catalog connector event | Entity / path | Notes |
| - | - | - |
| (discovery / smoke) | `GET /api/v2/tickets` | List tickets the agent can access |
| POST tickets from alarm | `POST /api/v2/tickets` | Create ticket; required `ticket.comment` |
| (show) | `GET /api/v2/tickets/{id}` | Ticket properties (not full comment thread) |
| PUT tickets/\{id} with resolution | `PUT /api/v2/tickets/{id}` | Set `status` (e.g. `solved`) and optional comment |
| GET tickets/\{id}/comments | `GET /api/v2/tickets/{id}/comments` | List comments |
| POST tickets/\{id}/comments | *(maps to PUT)* | **No create-comment endpoint** — add via `PUT` with `ticket.comment` |

`BASE_ADDRESS` is `https://{subdomain}.zendesk.com` (no trailing slash; endpoints already include `/api/v2/...`). Topics use `crm/zendesk/<object>/<verb>`.

> [!NOTE]
>
> Zendesk documents that ticket comments are created with the Tickets API, not a separate POST under `/comments`. Including `comment` on create or update is the supported path. See [Ticket Comments](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/).

> [!NOTE]
>
> Prefer Hub secrets for tokens. This template has not been verified against a live Zendesk subdomain. Status remains blocked until an authenticated live smoke succeeds.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — Zendesk Support (Ticketing API v2 curated slice)
# Auth: Bearer {value.json.access_token} (OAuth) or Basic email/token via config
# BASE_ADDRESS: https://YOUR_SUBDOMAIN.zendesk.com

DEFINE ROUTE ZendeskSupportRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://YOUR_SUBDOMAIN.zendesk.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Listtickets
        WITH SOURCE_TOPIC "crm/zendesk/tickets/list"
        WITH DESTINATION_TOPIC "crm/zendesk/tickets/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v2/tickets"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
    ADD EVENT Createticket
        WITH SOURCE_TOPIC "crm/zendesk/tickets/create"
        WITH DESTINATION_TOPIC "crm/zendesk/tickets/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v2/tickets"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
        WITH BODY "{payload}"
    ADD EVENT Showticket
        WITH SOURCE_TOPIC "crm/zendesk/tickets/show"
        WITH DESTINATION_TOPIC "crm/zendesk/tickets/show/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v2/tickets/{value.json.id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
    ADD EVENT Updateticket
        WITH SOURCE_TOPIC "crm/zendesk/tickets/update"
        WITH DESTINATION_TOPIC "crm/zendesk/tickets/update/response"
        WITH METHOD "PUT"
        WITH ENDPOINT "/api/v2/tickets/{value.json.id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
        WITH BODY "{payload}"
    ADD EVENT Listticketcomments
        WITH SOURCE_TOPIC "crm/zendesk/tickets/comments/list"
        WITH DESTINATION_TOPIC "crm/zendesk/tickets/comments/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v2/tickets/{value.json.id}/comments"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.access_token}"
```

## Events

| Event | Method | Endpoint | Request topic | Response topic |
| - | - | - | - | - |
| Listtickets | GET | `/api/v2/tickets` | `crm/zendesk/tickets/list` | `crm/zendesk/tickets/list/response` |
| Createticket | POST | `/api/v2/tickets` | `crm/zendesk/tickets/create` | `crm/zendesk/tickets/create/response` |
| Showticket | GET | `/api/v2/tickets/{id}` | `crm/zendesk/tickets/show` | `crm/zendesk/tickets/show/response` |
| Updateticket | PUT | `/api/v2/tickets/{id}` | `crm/zendesk/tickets/update` | `crm/zendesk/tickets/update/response` |
| Listticketcomments | GET | `/api/v2/tickets/{id}/comments` | `crm/zendesk/tickets/comments/list` | `crm/zendesk/tickets/comments/list/response` |

## Auth

**OAuth 2.0 Bearer — default in the template:**

1. Create an OAuth client in Zendesk Admin for your Support account.
2. Obtain an `access_token`.
3. Set connector `BASE_ADDRESS` to `https://{subdomain}.zendesk.com`.
4. Pass `access_token` on the MQTT request payload so headers resolve:
   * `Authorization: Bearer {value.json.access_token}`
5. Store the token in Hub secrets / `GET SECRET`. Never commit real credentials.

**API token Basic (email/token):**

1. In Zendesk Admin, create an API token for an agent email.
2. Use Basic auth with username `{email}/token` and password = the API token.
3. Prefer `WITH USERNAME "agent@example.com/token"` and `WITH PASSWORD GET SECRET "ZENDESK_API_TOKEN"` on `REST_API_CONFIG` (remove Bearer header lines if using config Basic).

## Example payloads

**Create ticket from alarm:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "access_token": "YOUR_ACCESS_TOKEN",
  "ticket": {
    "subject": "Line sensor fault — Zone A",
    "priority": "high",
    "type": "incident",
    "tags": ["iiot", "coreflux", "alarm"],
    "comment": {
      "body": "Vibration above threshold at 2026-10-04T00:00:00Z"
    }
  }
}
```

**Update with resolution:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "access_token": "YOUR_ACCESS_TOKEN",
  "id": 35436,
  "ticket": {
    "status": "solved",
    "comment": {
      "body": "Alarm cleared; sensor back online.",
      "public": true
    }
  }
}
```

**Add comment (catalog POST comments → PUT):**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "access_token": "YOUR_ACCESS_TOKEN",
  "id": 35436,
  "ticket": {
    "comment": {
      "body": "Follow-up from Coreflux telemetry.",
      "public": false
    }
  }
}
```

## Deploy notes

* Deploy **`ZendeskSupportRestApi.lot` only** (`-addRoute`). Do **not** deploy `hub-metadata.lot` as a connector — it exists for Hub / `-listTemplates` (`ADD METADATA` + `WITH IMAGE` base64).
* Hub category: **REST API Connectors**.
* Doc link: [https://docs.coreflux.org/latest/lot-language/routes/rest-api-apps/zendesk-support](https://docs.coreflux.org/latest/lot-language/routes/rest-api-apps/zendesk-support)

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps catalog](/latest/lot-language/routes/rest-api-apps)


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