Chats and Contacts
Chats and Contacts
Section titled “Chats and Contacts”Evolution API Lite provides comprehensive functionality for managing chats, contacts, and user profiles. This guide covers fetching conversations, managing contact information, handling message states, and updating profile settings.
Contact Management
Section titled “Contact Management”Check WhatsApp Numbers
Section titled “Check WhatsApp Numbers”Verify if phone numbers are registered on WhatsApp.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/whatsappNumbersRequest Body
Section titled “Request Body”{ "numbers": ["5511999999999", "5511888888888", "5511777777777"]}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/whatsappNumbers" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "numbers": ["5511999999999", "5511888888888"] }'Response
Section titled “Response”[ { "jid": "5511999999999@s.whatsapp.net", "exists": true, "number": "5511999999999", "name": "John Doe" }, { "jid": "5511888888888@s.whatsapp.net", "exists": false, "number": "5511888888888" }]Fetch Contacts
Section titled “Fetch Contacts”Retrieve contacts from the instance with optional filtering.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/findContactsRequest Body
Section titled “Request Body”{ "where": {}}{ "where": { "pushName": "John" }}{ "where": { "id": "5511999999999@s.whatsapp.net" }}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/findContacts" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "where": { "pushName": "John" } }'Response
Section titled “Response”[ { "_id": "contact_id_123", "id": "5511999999999@s.whatsapp.net", "pushName": "John Doe", "profilePictureUrl": "https://example.com/profile.jpg", "isGroup": false, "isUser": true, "isWAContact": true }]Chat Management
Section titled “Chat Management”Fetch Chats
Section titled “Fetch Chats”Retrieve all chats (conversations) with optional filtering.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/findChatsRequest Body
Section titled “Request Body”{ "where": {}}{ "where": { "id": "5511999999999@s.whatsapp.net" }}{ "where": {}, "limit": 50}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/findChats" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "where": {}, "limit": 20 }'Response
Section titled “Response”[ { "_id": "chat_id_123", "id": "5511999999999@s.whatsapp.net", "name": "John Doe", "isGroup": false, "unreadCount": 3, "archived": false, "pinned": false, "muteExpiration": 0, "lastMessageTimestamp": 1640995200 }]Archive/Unarchive Chats
Section titled “Archive/Unarchive Chats”Archive or unarchive chat conversations.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/archiveChatRequest Body
Section titled “Request Body”{ "chat": "5511999999999@s.whatsapp.net", "archive": true}{ "chat": "5511999999999@s.whatsapp.net", "archive": false}{ "lastMessage": { "key": { "id": "message_id_here", "remoteJid": "5511999999999@s.whatsapp.net", "fromMe": false }, "messageTimestamp": 1640995200 }, "archive": true}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/archiveChat" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "chat": "5511999999999@s.whatsapp.net", "archive": true }'Mute/Unmute Chats
Section titled “Mute/Unmute Chats”Control chat notifications by muting for a specified duration or unmuting.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/muteChatRequest Body
Section titled “Request Body”{ "chat": "5511999999999@s.whatsapp.net", "muteExpiration": 86400}{ "chat": "5511999999999@s.whatsapp.net", "muteExpiration": 0}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/muteChat" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "chat": "5511999999999@s.whatsapp.net", "muteExpiration": 86400 }'Pin/Unpin Chats
Section titled “Pin/Unpin Chats”Pin important conversations to the top or unpin them.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/pinChatRequest Body
Section titled “Request Body”{ "chat": "5511999999999@s.whatsapp.net", "pinned": true}{ "chat": "5511999999999@s.whatsapp.net", "pinned": false}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/pinChat" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "chat": "5511999999999@s.whatsapp.net", "pinned": true }'Mark Chats as Read/Unread
Section titled “Mark Chats as Read/Unread”Update the read status of chats.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/markReadRequest Body
Section titled “Request Body”{ "chat": "5511999999999@s.whatsapp.net", "read": true}{ "chat": "5511999999999@s.whatsapp.net", "read": false}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/markRead" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "chat": "5511999999999@s.whatsapp.net", "read": true }'Message State Management
Section titled “Message State Management”Get Message Status
Section titled “Get Message Status”Retrieve the delivery/read status of a specific message.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/messageStatusRequest Body
Section titled “Request Body”{ "key": { "id": "message_id_here", "remoteJid": "5511999999999@s.whatsapp.net", "fromMe": false }}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/messageStatus" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "key": { "id": "message_id_here", "remoteJid": "5511999999999@s.whatsapp.net", "fromMe": false } }'Get Message Delivery Status
Section titled “Get Message Delivery Status”Retrieve delivery status for a message in a specific chat.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/messageDeliveryStatusRequest Body
Section titled “Request Body”{ "remoteJid": "5511999999999@s.whatsapp.net", "fromMe": true, "id": "message_id_here"}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/messageDeliveryStatus" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "remoteJid": "5511999999999@s.whatsapp.net", "fromMe": true, "id": "message_id_here" }'Profile and Presence
Section titled “Profile and Presence”Update Profile Status (About)
Section titled “Update Profile Status (About)”Change the profile “About” status message.
Endpoint
Section titled “Endpoint”POST /profile/{instanceName}/updateStatusRequest Body
Section titled “Request Body”{ "status": "Available for chat"}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/profile/your-instance/updateStatus" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "status": "Available for chat" }'Update Profile Picture
Section titled “Update Profile Picture”Change the account’s profile picture.
Endpoint
Section titled “Endpoint”POST /profile/{instanceName}/updateProfilePictureRequest Body
Section titled “Request Body”{ "image": "https://example.com/new-profile-picture.jpg"}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/profile/your-instance/updateProfilePicture" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "image": "https://example.com/profile.png" }'Update Display Name
Section titled “Update Display Name”Change the account’s display name.
Endpoint
Section titled “Endpoint”POST /profile/{instanceName}/updateDisplayNameRequest Body
Section titled “Request Body”{ "name": "New Display Name"}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/profile/your-instance/updateDisplayName" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "name": "Support Account" }'Presence (Online/Typing)
Section titled “Presence (Online/Typing)”Control typing indicators and online presence.
Endpoint
Section titled “Endpoint”POST /chat/{instanceName}/presenceRequest Body
Section titled “Request Body”{ "id": "5511999999999@s.whatsapp.net", "type": "typing"}{ "id": "5511999999999@s.whatsapp.net", "type": "recording"}{ "id": "5511999999999@s.whatsapp.net", "type": "paused"}cURL Example
Section titled “cURL Example”curl -X POST "https://your-api-url/chat/your-instance/presence" \ -H "Content-Type: application/json" \ -H "apikey: your-api-key" \ -d '{ "id": "5511999999999@s.whatsapp.net", "type": "typing" }'Error Handling
Section titled “Error Handling”Common Errors
Section titled “Common Errors”- Invalid JID format
- Instance not connected
- Permission denied for group operations
- Invalid media/base64 encoding
- Rate limit exceeded
Standard Error Response
Section titled “Standard Error Response”{ "error": true, "message": "Error description", "details": { "code": "VALIDATION_ERROR", "field": "id" }}Best Practices
Section titled “Best Practices”-
Validate JIDs
Use the correct JID format for users (s.whatsapp.net) and groups (g.us).
-
Use Efficient Filters
Apply filters when fetching contacts/chats to reduce payload size and improve performance.
-
Respect Privacy Settings
Be mindful of user privacy and avoid intrusive presence updates.
-
Monitor Message States
Track message delivery and read status for reliable communication flows.
-
Webhooks Integration
Set up webhooks to receive real-time updates for chats, contacts, and messages.
Next Steps
Section titled “Next Steps”- Learn about Managing Groups
- Explore Sending Messages
- Set up Event System webhooks for real-time updates