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

# Reply Templates

> Wrap every email reply in your own HTML template and sign it per agent, with name, job title and email variables that adapt to who replied.

Every reply sent from an email address connected to OpenCX, whether the AI or a teammate wrote it, is wrapped in that address's **HTML template**. The template is also where the signature goes: its variables fill in the teammate who replied, so each agent signs their own emails from one shared layout.

## Where to edit it

* **Template:** open the address under **[Channels → Email](https://platform.open.cx/channels/configure/mail)**. The editor lists every variable and previews the result with sample values. You can also ask the Companion to write it, or use the [email channels API](https://docs.open.cx/api-reference/email/patch_channels.md).
* **Each teammate's job title:** set by the teammate in **Settings → My Profile**, or by an admin from the edit dialog on the **Members** page.

Without a custom template, OpenCX uses a simple default layout.

## Variables

| Variable | Value |
| - | - |
| `{{content}}` | **Required.** The reply itself |
| `{{agent_name}}` | The teammate who replied (or the session's assignee). Their alias when one is set |
| `{{agent_title}}` | That teammate's job title |
| `{{agent_email}}` | That teammate's email address. Empty when an alias is set, so the alias isn't unmasked. Showing agents' first names only does not hide it |
| `{{ticket_number}}` | The session's ticket number |
| `{{zendesk_ticket_id}}` | The linked Zendesk ticket ID; empty without one |
| `{{session.language}}` | The session's language code, such as `en` or `ar` |
| `{{quoted_content}}` | The earlier messages, quoted. Adding it turns inline history on |

> [!WARNING]
>
> The `agent_*` variables are **empty while only the AI has handled a session**. Wrap a personal sign-off in a condition, or AI replies will end with a blank name line.

## Sign each reply as the agent

```html theme={"dark"}
<div>{{content}}</div>
{{#if agent_name}}
  <p>
    <strong>{{agent_name}}</strong>
    {{#if agent_title}}<br />{{agent_title}}{{/if}}
    {{#if agent_email}}<br /><a href="mailto:{{agent_email}}">{{agent_email}}</a>{{/if}}
  </p>
{{else}}
  <p>The Support Team</p>
{{/if}}
```

Conditions support `{{#if …}}`, `{{elseif …}}`, `{{else}}` and `{{/if}}`, with `==`, `!=`, `&&`, `||` and `!`, for example `{{#if session.language == "ar"}}`.

## Tips

* Use tables and inline `style` attributes for layout; many mail clients ignore `<style>` blocks.
* Host logos and images at a public URL rather than embedding them; many mail clients block embedded images.
* Saving a template applies to the next reply from that address. Send yourself a test reply to check it in a real mail client.


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