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

# Ticket templates

> Ticket messages can use Headless templates and variables inside the real ticket context. Do not assume a template can execute arbitrary logic.

## Opening context

`.ticket open-message` is rendered when the ticket opens and receives `ticket.*`, `user.*`, `guild.*`, and `channel.*` values supplied by that event. Missing values render as `N/A`; the full list is in Ticket variables.

## Simple conditions, Tickets only

The opening message supports `{if condition}`, `{elseif condition}`, `{else}`, and `{/if}`. A condition can test `{variable}` for truth or compare `{variable} == value` / `{variable} != value`; expressions, additional operators, and nested blocks are not supported. At most one `{else}` is allowed, and every block must close with `{/if}`.

### `.ticket open-message`

```headless-command Syntax theme={null}
.ticket open-message [message]
```

```headless-command Example theme={null}
.ticket open-message {embed}$v{title:Ticket {ticket.case}}$v{description:Hello {ticket.author.mention}}
```

Also works: `.ticket open-message {if {ticket.open} == yes}Ticket is open.{elseif {ticket.closed_automatically} == yes}It closed automatically.{else}Ask support.{/if}`

> [!NOTE]
>
> Conditions are available only in the Tickets opening message; incomplete or nested blocks fail validation.

## Configure and validate

`.ticket open-message <message>` stores text or an embed template using the same context. Test with a ticket first; incomplete syntax, invalid conditions, or unknown variables stop the template rather than executing code.

## Steps

**1. Choose the context**

Conditions are evaluated only in the Tickets opening message; do not use them in Welcome, Auto Responder, or other templates.

**2. Write simple branches**

Compare a documented variable with `==` or `!=`, optionally add a fallback branch, and do not nest conditions.

**3. Test the message**

Open a test ticket and review the selected branch, variables, and embed before announcing the panel.

## Related pages

* [Ticket variables](/docs/en/server/tickets/variables.md)
* [Ticket messages](/docs/en/server/tickets/messages.md)
* [Embed scripting](/docs/en/resources/scripting/embeds.md)
* [Variables](/docs/en/resources/scripting/variables.md)


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