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

# Zendesk

> Zendesk integration for creator support tickets

EVO Dialed integrates with Zendesk for formal creator support ticket management.

## Overview

Zendesk handles:

* Creator support tickets
* Escalated issues
* Formal help requests

## Creator access

### Support link

Creators access support via `/support`:

* One-click Zendesk link
* Pre-authenticated
* No onboarding gate

### Deep link convention

Support uses the `?next=` login redirect:

```
/support?next=/zendesk/ticket/123
```

## Ticket creation

### From app

1. Creator taps "Get Help"
2. Support assistant tries to help
3. If needed, "Create Ticket" option
4. Ticket created in Zendesk
5. Creator receives confirmation

### API flow

```
Creator submits ticket
       │
       ▼
POST /api/creator/support/tickets
       │
       ▼
ZendeskClient.create_ticket
       │
       ▼
Ticket created in Zendesk
       │
       ▼
Confirmation shown to creator
```

## Implementation

### Zendesk client

**File:** `app/services/integrations/zendesk_client.rb`

```ruby theme={null}
client = Integrations::ZendeskClient.new
ticket = client.create_ticket(
  subject: "Help request",
  body: "Description...",
  requester_email: creator.email,
  requester_name: creator.name
)
```

### Methods

| Method          | Purpose               |
| --------------- | --------------------- |
| `create_ticket` | Create new ticket     |
| `get_ticket`    | Fetch ticket details  |
| `add_comment`   | Add comment to ticket |
| `list_tickets`  | List user's tickets   |

## Configuration

### Environment variables

| Variable            | Purpose           |
| ------------------- | ----------------- |
| `ZENDESK_SUBDOMAIN` | Account subdomain |
| `ZENDESK_EMAIL`     | API user email    |
| `ZENDESK_API_TOKEN` | API token         |

## Ticket flow

```
Creator submits
       │
       ▼
   ┌─────────┐
   │   New   │
   └────┬────┘
        │
        ▼
   ┌─────────┐
   │  Open   │◀─── Agent responds
   └────┬────┘
        │
        ▼
   ┌─────────┐
   │ Pending │◀─── Waiting for creator
   └────┬────┘
        │
        ▼
   ┌─────────┐
   │ Solved  │
   └─────────┘
```

## Backend files

| File                                                        | Purpose    |
| ----------------------------------------------------------- | ---------- |
| `app/services/integrations/zendesk_client.rb`               | API client |
| `app/controllers/api/creator/support_tickets_controller.rb` | Ticket API |
| `test/services/integrations/zendesk_client_test.rb`         | Tests      |

## Frontend

### Support assistant

**File:** `app/api/creator/support-assistant/route.ts`

AI-powered first-line support:

1. Creator asks question
2. Assistant searches resources
3. Provides answer or escalates

### Ticket creation UI

**File:** `components/app-shell/creator-support-assistant.tsx`

* Conversation interface
* Ticket creation form
* Confirmation display

## Error handling

| Error           | Handling                |
| --------------- | ----------------------- |
| API unavailable | Show error, retry later |
| Invalid request | Validate before submit  |
| Rate limited    | Queue and retry         |

## Testing

```ruby theme={null}
class Integrations::ZendeskClientTest < ActiveSupport::TestCase
  test "creates ticket successfully" do
    client = Integrations::ZendeskClient.new
    
    stub_zendesk_api do
      ticket = client.create_ticket(
        subject: "Test",
        body: "Test body",
        requester_email: "test@example.com"
      )
      
      assert ticket.id.present?
    end
  end
end
```
