# Connect WhatsApp through the official API (WhatsApp Cloud)

> How to create a WhatsApp Cloud inbox with your Meta details, set up the webhook in the Meta app and use templates outside the 24-hour window.

The **WhatsApp Cloud** inbox connects a number on the official WhatsApp API (Meta Cloud API). The credentials belong to your app at Meta: TalkVend only stores them, encrypted, and receives messages through the webhook you set up in the Meta dashboard.

## What you need from Meta

Before you start, have these at hand from the Meta developer dashboard (developers.facebook.com):

- the **WABA ID**, your WhatsApp Business account id;
- the **Phone Number ID**, the id of the number that will handle conversations;
- an **Access token** with access to that account;
- your app's **App secret**, used to validate the webhook signature.

The **Verify token** is optional: if you leave it blank, TalkVend generates one for you.

## Create the inbox

1. In the sidebar, open **Inboxes** and click **New inbox**.
2. Choose **WhatsApp Cloud**.
3. Fill in the fields described below.
4. Click **Create inbox**.

The form fields:

- **Name**: how the inbox appears to your team.
- **WABA ID** and **Phone Number ID**.
- **Access token**: not shown again once saved.
- **App secret**: also never shown again.
- **Verify token**: leave it blank to generate one automatically, or use at least 8 characters.
- **Graph version**: leave it blank to use the default (for example, `v21.0`).

## Set up the webhook at Meta

The last screen, **Inbox created — copy the secrets**, shows two values:

- **Webhook URL (configure it in the Meta dashboard)**;
- **Verify token (configure it in the Meta dashboard)**.

> **Warning:** the verify token won't be shown again. Copy both values before clicking **Copied, close**.

Then, in your app's Meta dashboard, open the WhatsApp webhook configuration and paste the callback URL and the verify token. Without this step, customer messages don't reach TalkVend.

The webhook URL stays visible later on the inbox page, under **Webhook URL (Meta dashboard)**.

## Keep the connection healthy

On the inbox page you can:

- click **Sync** to check the credentials. The result shows as **Connected** or **Failed — check the credentials**;
- use **Rotate** on the **Access token** when you generate a new token at Meta. The current token is replaced immediately;
- use **Rotate** on the **App secret** if it changes in the Meta app;
- use **Rotate** on the **Verify token** to generate a new one. After that, the webhook only validates again once you reconfigure the callback in the Meta dashboard with the new value.

## The 24-hour window

WhatsApp only allows free-form messages inside the 24-hour customer service window, counted from the customer's last message. In Conversations, the conversation shows **Window open · closes at** and the time, or **24h window closed**.

While the window is closed:

- sending free text is blocked (**Free-form sending blocked (window closed)**);
- you can still **Send template**, as long as it is approved at Meta;
- a **Private note** is still allowed, because it never goes to the customer.

When the customer replies, the window opens again for 24 hours.

> **Tip:** to start a conversation with a customer who hasn't written yet, use an approved template. It's the same rule as a closed window.

## Templates

Templates are message models sent to Meta for approval. You manage them in **Templates**, in the sidebar. Each template shows the status **Pending**, **Approved** or **Rejected**, and the **Sync** button brings the latest status from Meta. Only approved templates can be sent.

See how to create and use templates in [Templates](https://talkvend.com/en/help/templates), and how to send to many contacts in [Campaigns](https://talkvend.com/en/help/campanhas).
