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

# Automatic messages widget

> Each restaurant sees the emails its guests get automatically, personalizes its own copy in the Minimo editor and switches each one on or off

Each restaurant sees the emails its guests get automatically. It can preview them, personalize its own copy in the Minimo editor and switch each automatic send on or off.

## Mount it

Permission `templates` (in the default). Mount `urls.templates` from a [widget session](https://docs.minimo.it/embedded/widgets.md):

```html theme={null}
<div id="minimo-templates"></div>
<script src="https://api.minimo.it/public/v1/embed/widgets/widgets.js"></script>
<script>
  Minimo.mountWidget({
    url: session.urls.templates,
    container: '#minimo-templates',
    minHeight: 760,
    onEvent: function (event) {
      if (event.type === 'template.saved') console.log('copy saved', event.data.templateId);
      if (event.type === 'automation.toggled') console.log(event.data.rule, event.data.enabled);
    },
  });
</script>
```

## What the restaurant sees

![The automatic messages widget: three standard messages with Preview and Personalize, and two automatic sends switched on](https://mintcdn.com/minimo/9ObazzQQNYTDa_5r/images/embedded/widget-automatic-messages.png?fit=max\&auto=format\&n=9ObazzQQNYTDa_5r\&q=85\&s=7ae1252adaed430f0ca9535efaeae68c)

*Shown in Italian, the language of the demo restaurant. The widget follows the session `locale` (`en` or `it`).*

* **My automatic messages**: one row per **transactional** template you listed in `masterTemplateIds` (booking confirmation, reminder, review request…), marked **Standard** or **Personalized**.
* **Preview** shows the email as the restaurant's guests will get it, with the restaurant's brand. Merge fields such as `{GUEST_NAME}` stay visible.
* **Personalize** creates the restaurant's own copy of the template and opens it in the Minimo email editor, in the same frame. **Edit** reopens a copy; **Reset to standard** deletes the copy and goes back to your version.
* **Automatic sends** (shown when you defined [rules](https://docs.minimo.it/embedded/automations.md)): when each message goes out ("Immediately", "1 day before"), with an **On / Off** switch. Off stops that send for this restaurant only.
* Messages and rules are shown by the names you gave them, as they are.
* Every restaurant sees **every** master and rule, in every language. With 4 languages and 4 messages, a restaurant
  sees 16 messages. There is no filter by language.

![Preview of the booking confirmation with the restaurant's logo and color](https://mintcdn.com/minimo/9ObazzQQNYTDa_5r/images/embedded/widget-template-preview.png?fit=max\&auto=format\&n=9ObazzQQNYTDa_5r\&q=85\&s=1e279183285eb34012023ab775aeba1e)

## The editor

The editor is the same Minimo email editor your workspace uses, opened on the restaurant's copy through a single-use link. The restaurant can change texts, images, sections, colors and the subject. It cannot:

* remove the footer with the unsubscribe link, or hide the sender identity line;
* replace the email with HTML that drops the unsubscribe link (`422 TENANT_FOOTER_REQUIRED`);
* change merge variables: they stay as they are and are filled at send time.

The editor speaks the session language and can apply the restaurant's [brand color](https://docs.minimo.it/embedded/widget-brand.md). **Close** brings the list back. A later change to your master does not reach a copy the restaurant already personalized: **Reset to standard** picks up your current version.

## Sending with the restaurant's version

Keep sending the **master** template with the tenant reference. When the restaurant personalized it, Minimo uses its copy; otherwise your master, in the restaurant's brand:

```bash theme={null}
curl -X POST https://api.minimo.it/public/v1/templates/email/send \
  -H "Authorization: Bearer YOUR_MINIMO_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "transactional": "TRF4MS9",
    "recipient": "guest@example.com",
    "tenant": "restaurant_4812",
    "customFields": { "GUEST_NAME": "Anna", "BOOKING_TIME": "20:30" }
  }'
```

* `transactional` is the template **uid** (7 characters).
* `POST /public/v1/transactionals` behaves the same way. Add `sendAt` to [schedule](https://docs.minimo.it/embedded/schedule-email.md) the email.
* If you send the id of a restaurant's copy directly, the message is still recorded for its tenant; a `tenant` that does not own that copy answers `422 TENANT_TEMPLATE_MISMATCH`.
* Brand values you leave out of `customFields` (`RESTAURANT_NAME`, `LOGO_URL`, `BRAND_COLOR`…) come from the [tenant profile](https://docs.minimo.it/embedded/widget-brand.md#who-wins).

With [rules and events](https://docs.minimo.it/embedded/automations.md) you do not call the send endpoint at all: Minimo sends the right copy at the right time.

## Your templates as masters

* List them in `masterTemplateIds` of `PUT /public/v1/widgets/settings`. Transactional templates show here; campaign templates are the starters of the [Campaigns widget](https://docs.minimo.it/embedded/widget-campaigns.md).
* Confirmations, reminders and cancellations are **utility** (service) emails. A review request, an offer or a newsletter is **marketing**: a utility template that reads like one is refused as a master (`422 MASTER_LOOKS_PROMOTIONAL`). See [consent](https://docs.minimo.it/embedded/consent.md).

## Events

| `widget` | `type` | `data` |
| - | - | - |
| `templates` | `ready` | `count` |
| `templates` | `template.previewed`, `editor.opened` | `templateId` |
| `templates` | `template.customized` | `templateId` (the copy), `masterId` |
| `templates` | `template.reset` | `masterId` |
| `templates` | `automation.toggled` | `tenant`, `rule`, `enabled` |
| `editor` | `ready`, `template.saved`, `closed` | `templateId` |

The switch is saved by Minimo: read it back with `GET /public/v1/tenants/{tenant}/automations` (see [per tenant rules](https://docs.minimo.it/embedded/automations.md#per-restaurant-switch-off-or-change-a-rule)).

## If something fails

A widget that is not in the session's `permissions` answers `403 WIDGET_PERMISSION_DENIED`. A save that removes the unsubscribe link answers `422 TENANT_FOOTER_REQUIRED`. Every code, with what to do: [Errors and limits](https://docs.minimo.it/embedded/errors.md).

## Next step

[Campaigns widget](https://docs.minimo.it/embedded/widget-campaigns.md)


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