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

# WhatsApp syncing

> How the chats and contacts of the WhatsApp Business app come into ImpelLabs.

A tenant can keep its number on the WhatsApp Business app and use the same number with ImpelLabs. The app keeps working on
the phone. This is called coexistence. A number object has `coexistence` set to `true` when the number is on the app.

## What is requested

When a number that is on the WhatsApp Business app connects, ImpelLabs asks Meta for the contacts and for the history of
the chats. Meta allows these requests only within 24 hours of the sign-up. The request is made at connection time, so
connect the number soon after the tenant finishes the sign-up.

The hosted sign-up offers the tenant the choice between a number on the app and a new number. See
[Setup](https://docs.impellabs.tech/partners/channels/whatsapp/setup.md).

## How history arrives

Meta sends the history in chunks. ImpelLabs adds each message to its conversation. A message that is already there is
dropped, so the same chat does not appear twice. In the message object:

* `history` is `true` for a message from before the number was connected.
* `role` and `channel.from` or `channel.to` show who wrote it.

## Progress

Each chunk of history sends the event `channel.history_synced` to your [webhook endpoint](https://docs.impellabs.tech/partners/webhooks.md). The object
has `phone_number_id`, `phase` and `progress`. `progress` is a value from 0 to 100, and 100 is the last chunk of a phase.
Use it to show the tenant how far the import is.

```json theme={null}
{ "object": "channel", "channel": "whatsapp", "phone_number_id": "100000000000001", "phase": 0, "progress": 100 }
```

## Messages typed on the phone

A message that the business types in the WhatsApp Business app goes out from the phone. ImpelLabs reports it as
`message.sent` with `source` set to `business_app`. No delivery receipt follows for it. In the conversation list it
appears with `source` set to `business_app`, and it can pause the agent in that conversation, as any reply by a person
does.


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