List contact messages
Retrieve the most recent WhatsApp messages exchanged with a contact, across all of their conversations.
GET
/contacts/:uuid/messagesAuthentication
This endpoint authenticates with your API key sent in the X-API-Key header (ek_live_... format). You can manage your API keys from the Dev Tools section of the dashboard.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uuid | String | Required | UUID of the contact. |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | Integer | Optional | Number of messages to return (default 100, max 200). |
Example request
bash
curl -X GET "https://api.eclecticlabs.com/api/external/v2/contacts/eb2b914a-977e-4ab8-96e7-b886698b3eac/messages?limit=50" \
-H "X-API-Key: ek_live_your_api_key_here"Example response
json
{
"messages": [
{
"uuid": "a1b2c3d4-0002-0000-0000-000000000000",
"status": "sent",
"channel": "whatsapp",
"createdAt": "2024-09-24T11:32:05Z",
"from": "56987654321",
"to": "56912345678",
"text": "Hi! How can we help?",
"attachments": [],
"media": [],
"metadata": {}
},
{
"uuid": "a1b2c3d4-0001-0000-0000-000000000000",
"status": "received",
"channel": "whatsapp",
"createdAt": "2024-09-23T20:09:10Z",
"from": "56912345678",
"to": "56987654321",
"text": "",
"attachments": [
"https://storage.googleapis.com/eclectic-media/documents/6f9a...c2.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Expires=7200&..."
],
"media": [
{
"id": 482,
"url": "https://storage.googleapis.com/eclectic-media/documents/6f9a...c2.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Expires=7200&...",
"filename": "cotizacion.pdf",
"contentType": "application/pdf"
}
],
"metadata": {}
}
]
}Notes
- Messages are returned newest first.
- status is sent or received depending on the message direction, or failed if delivery failed.
- attachments contains signed download URLs for any files exchanged in the message. media contains the same files as objects with metadata: id, url, filename and contentType (filename and contentType may be null).
- Signed media URLs expire after 120 minutes. Download the file promptly, or request a fresh URL with GET /media/:id using the media item's id — do not store the URL.
- Possible errors: 400 (validation), 401 (invalid or missing API key), 404 (contact not found).