> ## 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.

# WhatsApp widget

> Coming soon: each restaurant connects its own WhatsApp number to its own WhatsApp Business account, from inside your app

Coming soon: each restaurant connects its own WhatsApp number to its own WhatsApp Business account, from inside your app. Until then, your restaurants' automatic messages and campaigns are email only.

## Mount it

The WhatsApp widget is **not** in the default permissions: mint the session with `whatsapp` in `permissions` (with any other permission you need) and mount `urls.whatsapp`:

```html theme={null}
<div id="minimo-whatsapp"></div>
<script src="https://api.minimo.it/public/v1/embed/widgets/widgets.js"></script>
<script>
  Minimo.mountWidget({
    url: session.urls.whatsapp,
    container: '#minimo-whatsapp',
    minHeight: 520,
    onEvent: function (event) {
      if (event.type === 'whatsapp.connected') console.log('connected', event.data.number);
      if (event.type === 'whatsapp.connect_requested') {
        window.open(event.data.url, 'minimo-wa-connect', 'width=720,height=820');
      }
    },
  });
</script>
```

`whatsapp.connect_requested` arrives when the browser blocked the setup window: open `event.data.url` yourself, from a click of the user.

## What the restaurant sees

![The WhatsApp widget before it is enabled: how it works, what the restaurant needs, and the connect button marked coming soon](https://mintcdn.com/minimo/9ObazzQQNYTDa_5r/images/embedded/widget-whatsapp.png?fit=max\&auto=format\&n=9ObazzQQNYTDa_5r\&q=85\&s=d58136ed762d279dd50fa69382d26281)

*Shown in Italian, as it looks before Minimo enables the connection for the workspace.*

* **How it works**, in plain words: a number already on the WhatsApp Business app stays on the app; a new number gets a code by SMS; what the restaurant needs (a Facebook account, the phone with the number, a card).
* **Connect WhatsApp** opens the setup in its own window.
* Once connected: the number, the display name with Meta's review (approved, in review, declined), the quality (high, medium, low) and the sending limit.

The widget shows "Coming soon" and its button is off. This page describes how it will work.

## How it works

* **The restaurant owns the number and pays Meta.** The number lives on the restaurant's own WhatsApp Business account in its own Meta business portfolio. Meta charges the conversations to the card on that account.
* **Two ways to connect.** A number already on the WhatsApp Business app stays on the app (chats and contacts stay on the phone) and connects to the platform too. A new number gets a code by SMS during the setup.
* **The setup runs in its own window.** "Connect WhatsApp" opens a window on Minimo, then Meta's window: never inside your iframe, so third-party cookies and iframe sandboxes do not matter. Meta's window shows Minimo, the technology provider: Meta does not let us change that name.
* **One number, one restaurant.** A number already connected to Minimo (any workspace or restaurant) is refused, never moved.

## Events

| `type` | `data` |
| - | - |
| `ready` | `tenant`, `status` (`not_connected`, `connecting`, `connected`, `error`) |
| `whatsapp.connected` | `tenant`, `number` |
| `whatsapp.error` | `tenant`, `code` (below) |
| `whatsapp.connect_requested` | `tenant`, `url` |

## Errors

The widget explains every error in plain words. Codes in `whatsapp.error`:

| `code` | Meaning |
| - | - |
| `cancelled` | The setup stopped before the end. |
| `number_attached_elsewhere` | The number is still connected to another WhatsApp provider: the restaurant must ask that provider to release it. |
| `no_number` | No number was picked in Meta's window. |
| `number_in_use` | The number is already connected to Minimo (any workspace or restaurant). Nothing was changed. |
| `pin_required` | The number has a two-step verification PIN set elsewhere: turn it off in WhatsApp Manager, then try again. |
| `registration_failed`, `subscribe_failed`, `signup_error` | Meta did not finish the setup: try again in a few minutes. |

## If something fails

The widget explains every error in plain words: see the codes in [Errors](#errors) above.

## Next step

[Consent, unsubscribe and preferences](https://docs.minimo.it/embedded/consent.md)


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