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

# Macros

> Save the replies your team writes every day and insert them into any ticket from the composer.

A macro is a saved reply. You write it once, give it a name, and from then on any agent can drop it into a ticket with two clicks, edit it if the situation calls for it, and send.

Macros suit the answers your team repeats: a refund policy, a request for an order number, a "we're looking into it" holding reply, a closing line. The text is plain, so it reads the same whether it lands in an email thread or a chat.

Macros are shared. Every macro belongs to one AI agent and is visible to everyone who works its Helpdesk. There are no private macros. A workspace with two AI agents keeps a separate list for each.

***

## Inserting a macro

Open a ticket and click the **Macros** button in the reply composer toolbar. It has a lightning-bolt icon and sits next to the AI compose button.

<Steps>
  <Step title="Pick a macro">
    The list is alphabetical. Once you have five or more macros a **Search macros...** box appears at the top so you can type part of a name instead of scrolling.
  </Step>

  <Step title="Read it over">
    The text lands at your cursor. If the line you are on already has text, the macro starts on a new line beneath it. Anything you have already typed stays put.
  </Step>

  <Step title="Edit and send">
    A macro is ordinary text once inserted. Trim it, add a sentence, or send it as is.
  </Step>
</Steps>

Macros work in both the reply and the internal note composer. If your cursor is inside a bulleted list or a code block, the inserted text takes on that block's formatting.

If you can manage macros, the bottom of the picker also offers **Add macro**, which opens the create dialog without leaving the ticket. Handy when you have just typed a reply you know you will need again.

***

## Variables

A macro can carry placeholders that fill in from the ticket at the moment you insert it. Write `{{customer.first_name}}` and the agent sees `Hi Dana,` instead of a blank to fill.

| Variable                  | Fills in with                                   |
| ------------------------- | ----------------------------------------------- |
| `{{customer.name}}`       | The customer's full name                        |
| `{{customer.first_name}}` | The first word of the customer's name           |
| `{{customer.email}}`      | The customer's email address                    |
| `{{agent.name}}`          | Your full name, as set on your Helpdesk profile |
| `{{agent.first_name}}`    | The first word of your name                     |
| `{{ticket.number}}`       | The ticket number                               |

Variables resolve when the macro is inserted, using the ticket you have open and the account you are signed in with. Two agents inserting the same macro get different signatures.

### Fallbacks

Not every ticket has a customer name. Add a fallback after a `|` and it is used whenever the variable is empty:

```
Hi {{customer.first_name | there}},
```

You can chain variables. The first one with a value wins, and a plain word at the end is the last resort:

```
{{customer.first_name | customer.name | there}}
```

Set a fallback on every customer variable. A customer or ticket variable with no value and no fallback stays in the reply as literal text, `{{customer.name}}` and all, for the agent to notice and fix. Agent variables are the exception. If your name is missing they resolve to nothing rather than leaking a placeholder into a customer-facing message.

<Tip>Keep fallbacks generic. `there` and `your order` read fine in every ticket. A fallback like `valued customer` sounds like a form letter the moment it appears.</Tip>

***

## Managing macros

Macros live on **Settings → Helpdesk → Macros**. The page lists every macro by name with a preview of its reply, a **Search macros...** box, and a **Create macro** button. Each row has an **Edit** and **Delete** action behind its menu.

### Creating a macro

<Steps>
  <Step title="Click Create macro">
    The **New macro** dialog opens.
  </Step>

  <Step title="Name it">
    The name is how agents find the macro in the composer, so make it the thing they would search for: `Refund policy`, not `Reply 12`. Names are unique within the AI agent, ignoring case.
  </Step>

  <Step title="Write the reply">
    Type the text as you want it to land. Type `{{` anywhere to open the variable list, or click **Add variable** above the field. The **Add variable** popover has an **If missing, use** box, so you can set the fallback and pick the variable in one step.
  </Step>

  <Step title="Click Create macro">
    The macro appears in every agent's composer straight away.
  </Step>
</Steps>

If you type a placeholder that does not match a variable, say `{{customer.phone}}`, the dialog warns you that it will be inserted as text. Nothing stops you saving it, so read the warning.

### Editing a macro

Pick **Edit** on the row. Changes take effect for the next insertion. Replies already sent keep the old wording.

### Deleting a macro

Pick **Delete** on the row and confirm. The macro is removed for everyone on the AI agent, and there is no undo. Tickets where it was already used are unaffected, since the text was pasted in at insertion time.

***

## Who can do what

| If you can    | You can                                                            |
| ------------- | ------------------------------------------------------------------ |
| View tickets  | Insert any macro from the composer and browse the list in settings |
| Manage macros | Create, edit, and delete macros                                    |

Owners can manage macros. For everyone else it is a separate permission, granted per role alongside the other Helpdesk permissions. Most support agents only need to insert. Keep the manage permission with the few people who decide how your replies should sound.

***

## Good to know

* Macros are part of the Helpdesk, so they need a plan that includes it.
* Each AI agent can hold up to 300 macros. At the cap, **Create macro** greys out and tells you why when you hover it.
* Names can run to 200 characters. A reply can run to 20,000.
* Chatbase stores replies as plain text. Bold, links, and other formatting from the editor do not survive the save.
* The variable list covers customer, agent, and ticket fields. Anything else inside `{{ }}` stays as typed.
