# Gorgias

Attify reads Gorgias through its API, read-only, with OAuth or an API token, for customer support. It is the customer's own system, so what Attify reads there is connected data: the strongest provenance, and what a vendor verification rests on.

## As a help desk, for customer support

| Stored            | Gorgias                                                                     |
|-------------------|-----------------------------------------------------------------------------|
| id                | ticket `id`                                                                 |
| started_at        | ticket `created_datetime`                                                   |
| updated_at        | ticket `updated_datetime`, the sync cursor                                  |
| customer          | ticket `customer.id`                                                        |
| channel           | ticket `channel`                                                            |
| claim             | AI Agent's own tags, read as it sets them, when it took part (any `ai_`     |
|                   | outcome tag, or a message from it): `ai_close` ("closed without human       |
|                   | involvement") without `ai_handover` claims a resolution; `ai_handover`, or  |
|                   | a final outcome without `ai_close`, claims none; `ai_processing` or         |
|                   | `ai_snooze` alone is no outcome yet (no claim). No AI Agent: no vendor      |
|                   | claim, so the reconstructed claim applies                                   |
| messages          | public messages, oldest first: `stripped_text`, else `body_text`. Internal  |
|                   | notes, failed or deleted messages, and replies sent by a rule (`rule_id`)   |
|                   | or a self-service flow (`via` self_service) are left out: nobody's reply    |
| messages[].role   | `from_agent` false: the customer; true: support                             |
| messages[].author | "ai" when the sender is a user whose role is `bot` (AI Agent appears in the |
|                   | help desk as a user of its own, "AI Agent Bot" by default and renameable,   |
|                   | so it is matched by id and role, never by name); "human" otherwise          |
| reopens           | `ticket-reopened` events, at their `created_datetime`                       |
| merged_from       | tickets a `ticket-merged` event names, and messages in the ticket whose own |
|                   | `ticket_id` is another ticket's (Gorgias deletes a merged ticket and moves  |
|                   | its messages into the survivor): those messages become a stored item of     |
|                   | their own, `merged_into` the survivor, so they are a contact, never part of |
|                   | the survivor's conversation                                                 |
| rating            | the satisfaction survey's `score` (1 to 5) at `scored_datetime`; 4 or 5 is  |
|                   | satisfied. Customer satisfaction is its own signal: the merchant's question |
|                   | asks about satisfaction, so it never confirms a resolution                  |
