> For the complete documentation index, see [llms.txt](https://docs.360dialog.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.360dialog.com/docs/inbox/inbox-api/playbooks/put-whatsapp-inside-your-crm-or-product.md).

# Put WhatsApp inside your CRM or product

Show and answer WhatsApp conversations where your users already work.

Your users see WhatsApp conversations next to the customer record they already use, and reply from there. The Inbox stores the conversations and handles WhatsApp; your product only reads, displays and sends.

{% hint style="info" icon="lightbulb-on" %}
**You do not need to store messages on your side.** The Inbox keeps the full history of every conversation, and your product fetches it whenever it needs to show it.
{% endhint %}

**What you end up with**

* Every new WhatsApp contact gets a record in your CRM automatically
* Existing deals and clients update when the customer writes, and the ones that need attention are flagged
* Opening a record shows its WhatsApp conversation, straight from the Inbox
* Your users reply from your product, with templates when the window is closed

{% stepper %}
{% step %}
**Give your product its own user**

In the Inbox admin panel, create a user for your product in the **App integration** group, request its token and store it — see [Authentication](/docs/inbox/inbox-api/authentication.md). Every call below sends that token, and every message your product sends shows that user as the sender.
{% endstep %}

{% step %}
**Get told about new messages**

Register a webhook for incoming messages:

```bash
curl -X POST $INBOX/api/v1/webhooks/waba/ \
  -H "Authorization: Token $SERVICE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://your-product.example.com/whatsapp", "on_incoming_message": true}'
```

The webhook is not there to copy messages into your product. It is a signal that a customer just wrote, so your CRM can react: create a record for someone new, or update the record you already have.

Reference: [Create webhook](/docs/inbox/inbox-api/api-ref/webhooks.md#post-api-v1-webhooks-waba)
{% endstep %}

{% step %}
**React to each message**

When a message arrives, find out who sent it:

1. Look up the BSUID (`contacts[].user_id`) in your records
2. If there is no match and the payload has a phone number, look that up

**New contact?** Create a record — a new lead, deal or client, depending on your CRM. Store the BSUID and the `wa_id` on it; the `wa_id` is what you use to fetch the conversation later. Some customers never share a phone number with you, so do not make it a required field. See [Contacts](/docs/inbox/inbox-api/contacts.md).

**Existing contact?** Update the record so your team sees what is happening without opening WhatsApp. For example:

* Set the last contact date, so stale deals and quiet clients are easy to spot
* Move a deal forward, such as from *contacted* to *replied*
* Flag the record as needing attention — the customer is waiting for an answer, or the message mentions something urgent like a complaint or a cancellation
  {% endstep %}

{% step %}
**Show the conversation**

When a user opens a record, pull the conversation from the Inbox using the stored `wa_id`:

```bash
curl -H "Authorization: Token $SERVICE_TOKEN" "$INBOX/api/v1/messages/?wa_id=$WA_ID&limit=20"
```

Load older messages with `before_time` as the user scrolls — see [Reading conversations](/docs/inbox/inbox-api/reading-conversations.md). To keep an open conversation up to date, fetch it again, or use a websocket connection to get new messages as they happen (advanced).

Reference: [List messages](/docs/inbox/inbox-api/api-ref/messages.md#get-api-v1-messages)
{% endstep %}

{% step %}
**Reply from your product**

Before showing a free-form reply box, check `contact.messaging_window_expires_at` on the [chat](/docs/inbox/inbox-api/api-ref/chats.md#get-api-v1-chats-wa_id). If the window is open, send the user's text. If it is closed, offer your approved templates instead. See [Sending messages](/docs/inbox/inbox-api/sending-messages.md).

When your user replies, clear the "needs attention" flag you set in the previous step.

Reference: [Create message](/docs/inbox/inbox-api/api-ref/messages.md#post-api-v1-messages)
{% endstep %}
{% endstepper %}

## Keep the hosted Inbox as a fallback

Your team can still open the hosted Inbox at any time and see the same conversations, including what your product sent. It is useful for people who do not work in your product, and as a backup if your integration is down. [Learn more about Hosted Inbox](/docs/inbox/hosted-inbox.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.360dialog.com/docs/inbox/inbox-api/playbooks/put-whatsapp-inside-your-crm-or-product.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
