# WhatsApp

Send and receive WhatsApp messages. Pair a phone number, view 1:1 conversations and group conversations, send messages, and manage CRM links.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### GET /whatsapp/conversations

List WhatsApp 1:1 conversations in the workspace inbox. Supports filtering by external_phone_number and unread.

**Scopes:** `whatsapp:read` — [full detail](./whatsapp/get-whatsapp-conversations.md)

### GET /whatsapp/conversations/:conversation_id

Fetch a single WhatsApp conversation by UUID.

**Scopes:** `whatsapp:read` — [full detail](./whatsapp/get-whatsapp-conversations-conversation-id.md)

### PATCH /whatsapp/conversations/:conversation_id

Update a WhatsApp conversation (e.g. mark read, archive).

**Scopes:** `whatsapp:write` — [full detail](./whatsapp/patch-whatsapp-conversations-conversation-id.md)

### GET /whatsapp/conversations/:conversation_id/messages

List all messages in a WhatsApp conversation in chronological order.

**Scopes:** `whatsapp:read` — [full detail](./whatsapp/get-whatsapp-conversations-conversation-id-messages.md)

### POST /whatsapp/send

Send a WhatsApp message to a contact. Provide either to_phone (E.164) or conversation_id. Costs credits.

**Scopes:** `whatsapp:send` — [full detail](./whatsapp/post-whatsapp-send.md)

### POST /whatsapp/groups/send

Send a WhatsApp message into a registered group. Group must be visible to the workspace (paired account is a member). Costs credits.

**Scopes:** `whatsapp:send` — [full detail](./whatsapp/post-whatsapp-groups-send.md)

### GET /whatsapp/groups

List WhatsApp groups the workspace's paired account is in. Filter by linked_deal_id, linked_customer_id, or unlinked.

**Scopes:** `whatsapp:read` — [full detail](./whatsapp/get-whatsapp-groups.md)

### GET /whatsapp/groups/:group_id

Fetch a single WhatsApp group by UUID, including member list snapshot.

**Scopes:** `whatsapp:read` — [full detail](./whatsapp/get-whatsapp-groups-group-id.md)

### GET /whatsapp/groups/:group_id/messages

List all messages in a WhatsApp group in chronological order.

**Scopes:** `whatsapp:read` — [full detail](./whatsapp/get-whatsapp-groups-group-id-messages.md)

### POST /whatsapp/groups/:group_id/link

Link a WhatsApp group to a deal or customer so its messages appear in the deal/customer timeline.

**Scopes:** `whatsapp:write` — [full detail](./whatsapp/post-whatsapp-groups-group-id-link.md)

### POST /whatsapp/groups/:group_id/unlink

Remove a WhatsApp group's deal/customer link. The group remains visible in the inbox.

**Scopes:** `whatsapp:write` — [full detail](./whatsapp/post-whatsapp-groups-group-id-unlink.md)

### GET /whatsapp/pairing

Get the workspace's WhatsApp pairing status (connected / awaiting_qr / disconnected / etc.) and paired phone identity.

**Scopes:** `whatsapp:read` — [full detail](./whatsapp/get-whatsapp-pairing.md)

### POST /whatsapp/pair

Begin pairing a WhatsApp account to the workspace. Returns a QR code data URL the user scans with their phone (Settings → Linked Devices → Link a Device). The pairing becomes "connected" automatically once they scan.

**Scopes:** `whatsapp:write` — [full detail](./whatsapp/post-whatsapp-pair.md)

### POST /whatsapp/disconnect

Disconnect the workspace's WhatsApp pairing. Deletes the Evolution instance and clears the pairing row. Use to re-pair against a different phone.

**Scopes:** `whatsapp:write` — [full detail](./whatsapp/post-whatsapp-disconnect.md)
