# Helpdesk Ticket Sync

Create, read, and update support tickets, tags, assignees, and internal notes in Zendesk, Intercom, or Freshdesk through the org's configured helpdesk Integration.

## When to use

- A customer or teammate reports an issue and a ticket needs to be created, looked up, or updated in the helpdesk.
- A ticket needs re-tagging, reassignment, priority change, or an internal note added for the support team.
- Someone asks for the status or history of a specific ticket.
- A reply needs to be drafted for a ticket, pending human review before it is sent to the customer.

## Tools

- `http-get`
- `http-post`
- `http-request`

## Playbook

1. Confirm which helpdesk platform the org uses (Zendesk, Intercom, or Freshdesk) and use its REST API base URL for every call.
2. To look up an existing ticket, call `http-get` against the platform's ticket endpoint, e.g. GET `https://{subdomain}.zendesk.com/api/v2/tickets/{id}.json`. Auth is injected by the org's Integration row for this host — never ask for, echo, or hardcode credentials.
3. To create a new ticket, call `http-post` with the subject, description, requester, and any known tags, e.g. POST `https://api.intercom.io/conversations`.
4. To update fields such as tags, assignee, priority, or status, use `http-request` with a PUT or PATCH method, e.g. PATCH `https://{domain}.freshdesk.com/api/v2/tickets/{id}` with the changed fields in the body.
5. To add an internal note (not visible to the customer), use `http-request` with the platform's private-note or internal-comment field set to true, e.g. POST `https://{subdomain}.zendesk.com/api/v2/tickets/{id}/comments.json` with `public: false`.
6. To close, merge, or delete a ticket, use `http-request` with the appropriate DELETE or status-change PATCH call, matching the platform's documented endpoint.
7. Before answering any policy or troubleshooting question inside a ticket, check the org's knowledge base for the relevant article — never invent policy or promise a resolution the knowledge base does not support.
8. If a customer-facing reply is warranted, draft the reply text and hold it for human review; only send automatically if the org has explicitly opted into auto-send for this ticket type.
9. On a 401/403 response, or if no Integration row exists for the target helpdesk host, stop and message a human via `send-message` naming the service and the scopes needed, rather than retrying with guessed credentials.

## Failure modes

- The org has not connected an Integration for the target helpdesk host, so every call returns 401/403 — stop and escalate rather than retrying blind.
- The requested update (e.g. merging two tickets, custom field types) isn't supported by a simple PATCH and needs a platform-specific endpoint you haven't confirmed — verify the endpoint before calling, or hand off to a human.
- A ticket ID or requester email doesn't match any record, producing a 404 — report this back rather than fabricating a ticket.
- A reply is auto-sent when the org has not opted into auto-send, bypassing required human review.

## Done when

- The requested ticket has been created, retrieved, or updated with the correct fields, tags, assignee, or note reflected in the helpdesk.
- Any customer-facing reply has been drafted and routed for human review, or sent only where auto-send is explicitly authorized.
- Any auth failure or unsupported action has been escalated to a human with the specific service and scope named.