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

# Helpdesk Ticketing: Submit and Manage Support Requests

> Submit and manage support tickets in Site Store Pro with ticket forms, staff console, agent queues, tokenized guest links, and inbound email replies via webhook.

Site Store Pro includes a full helpdesk ticketing system — customers can open support requests from their dashboard or directly via `/tickets/create`, staff manage and reply through the admin console, and tokenized guest links let unauthenticated visitors track their tickets without logging in.

***

## Customer Ticket Submission

### Creating a Ticket

Customers navigate to `GET /tickets/create` to open a new support request. The submission form accepts:

| Field            | Details                                           |
| ---------------- | ------------------------------------------------- |
| Subject          | Short summary of the issue                        |
| Category Tags    | One or more category tags to classify the request |
| Description      | Full-text description of the problem or question  |
| File Attachments | Up to **5 MB** per attachment                     |

<Tip>
  File attachments are a great way to share screenshots, error logs, or order confirmation PDFs directly with support staff.
</Tip>

### Viewing a Ticket Thread

| Route                       | Access                                                              |
| --------------------------- | ------------------------------------------------------------------- |
| `GET /tickets/{id}`         | Authenticated ticket thread — requires the customer to be logged in |
| `GET /tickets/view/{token}` | Tokenized guest access — works without authentication               |

The tokenized link (`/tickets/view/{token}`) is automatically included in every ticket confirmation and staff reply email. This gives unauthenticated customers — such as guest checkout buyers — secure read and reply access to their ticket thread without needing an account.

<Info>
  Tokenized links are cryptographically unique per ticket. Sharing the link gives the recipient full thread access, so treat them like a password.
</Info>

***

## Customer Dashboard

Logged-in customers access all self-service tools from a single tab-switched workspace at `GET /dashboard`.

### Dashboard Tabs

| Tab                   | Route            | Contents                                                              |
| --------------------- | ---------------- | --------------------------------------------------------------------- |
| **Support Tickets**   | `?tab=tickets`   | View, filter, and track past and active ticket threads                |
| **Order History**     | `?tab=orders`    | Expandable row accordion with inline invoices                         |
| **Digital Downloads** | `?tab=downloads` | Expiration dates, remaining download count, and secure download links |

### Admin & Agent Redirect

<Warning>
  Admins and agents (roles 3, 4, and 5) who land on `/dashboard` are **automatically redirected** to `/admin/dashboard`. The customer dashboard is only visible to roles 1 and 2.
</Warning>

### Conditional Navigation

The public site header adapts based on the authenticated user's role:

* **Customers (roles 1 & 2):** Public header with site logo, **Tickets**, **Orders**, and **Downloads** tabs, profile controls, and sign-out link.
* **Admins & Staff (roles 3, 4 & 5):** Full backoffice administration sidebar — the public header is not shown.

***

## Staff Operations

### Admin Ticket Console

`GET /admin/tickets`

The main ticket management interface for administrators. Features include:

<CardGroup cols={2}>
  <Card title="Search & Filter" icon="magnifying-glass">
    Full-text search across all tickets with status and category filters.
  </Card>

  <Card title="Status Updates" icon="circle-check">
    Update ticket status (open, pending, resolved, closed) in bulk or individually.
  </Card>

  <Card title="Agent Assignment" icon="user-check">
    Assign tickets to specific support agents from a staff member dropdown.
  </Card>

  <Card title="Post Replies" icon="reply">
    Write and send staff replies directly from the console, with attachment support.
  </Card>
</CardGroup>

* **Pagination:** 25 tickets per page
* **Delete:** Admins can permanently delete tickets from this view

### Agent Queue

`GET /admin/assigned-tickets`

A focused view showing **only the tickets assigned to the currently authenticated agent**. This keeps agents' workloads clear without the noise of the full queue.

***

## Email Notifications

The system supports:

* Ticket creation confirmations
* Ticket status updates
* New reply notifications
* Email conversation threading

Closed tickets do not send status notification emails.

***

## Secure Ticket Links

Customers can access tickets without logging in using secure token URLs.

Example:

```
/tickets/view/{uuid-token}
```

These links allow customers to:

* View ticket conversations
* Reply securely

***

## Email Based Ticket Replies

Customers can reply directly through email.

Example:

```
reply+{ticket-token}@yourdomain.com
```

The system automatically:

* Matches replies to tickets
* Creates new replies
* Maintains conversation history

Supported providers:

* Cloudflare Email Routing
* Mailgun
* Postmark

***

# Ticket Email Configuration

Default development mode:

```env theme={null}
MAIL_MAILER=log
```

Emails will be written to:

```
storage/logs
```

For production configure:

* SMTP
* Mailgun
* Postmark
* Other Laravel mail providers

***

# Email Reply Webhook

Configure your provider to send:

```
POST /webhooks/inbound-email
```

***

All providers must include a header field called: X-Webhook-Secret
This value must be set as .env variable: INBOUND\_WEBHOOK\_SECRET

***

Supported payload formats:

Generic JSON:

```json theme={null}
{
"from_email":"customer@example.com",
"from_name":"Customer",
"body":"Reply text"
}
```

Mailgun:

```
recipient
sender
from
body-plain
```

Postmark:

```
ToFull
FromFull
TextBody
```

Cloudflare

```
recipient
raw
```

### Cloudflare Email Worker Setup

If you are using Cloudflare Email Routing for inbound ticket replies, create an Email Worker that forwards incoming emails to the Laravel webhook endpoint.

After creating the Email Worker, open the code editor and replace the worker code with the following.

**Important:** Update these two values before deploying:

1. Replace:

```
https://yourdomain.com/webhooks/inbound-email
```

with your actual Laravel webhook URL.

If your app is installed in a subdirectory, include it:

```
https://yourdomain.com/folder-name/webhooks/inbound-email
```

2. Replace:

```
X-Webhook-Secret
```

with the same value configured in your Laravel `.env` file:

```env theme={null}
INBOUND_WEBHOOK_SECRET=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx
```

Cloudflare Email Worker:

```javascript theme={null}
export default {
  async fetch(request, env, ctx) {
    return new Response("Inbound Email Worker Running");
  },

  async email(message, env, ctx) {
    try {

      // Entire RFC822 message
      const rawEmail = await new Response(message.raw).text();

      const payload = {
        recipient: message.to,
        raw: rawEmail
      };

      const response = await fetch(
        "https://yourdomain.com/webhooks/inbound-email",
        {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            "X-Webhook-Secret": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
          },
          body: JSON.stringify(payload)
        }
      );

      if (!response.ok) {
        const text = await response.text();

        console.error(
          `Laravel returned ${response.status}: ${text}`
        );

        throw new Error(
          `Webhook failed (${response.status})`
        );
      }

      console.log("Inbound email successfully forwarded.");

    } catch (err) {

      console.error(
        "Cloudflare Email Worker Error:",
        err.stack || err.message
      );

      throw err;
    }
  }
};
```

After saving the worker:

1. Click **Deploy**
2. Return to **Email Routing**
3. Add the worker as the destination for your support reply domain
4. Send a test email to verify the Laravel ticket reply is created

***

# Ticket Attachment File Upload Configuration to CDN (S3 | Cloudfront)

Set `s3` as the filesystem (upload destination) in `.env`:

```env theme={null}
FILESYSTEM_DISK=s3
```

Enter your S3 bucket credentials in `.env`:

```env theme={null}
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
```

Enter the URL to your S3 bucket or CloudFront distribution domain in `.env` under:

```env theme={null}
CDN_URL=https://abc123456.cloudfront.net
```

***

<Tip>
  Configure the reply-to domain in your DNS and mail provider settings to match `reply+*@yourdomain.com` so all tokenized reply addresses are routed correctly.
</Tip>
