Overview

The Contact Management module provides functionality to retrieve, view, and manage WhatsApp contacts within your application. These methods allow you to access contact information, view profile pictures, and maintain an up-to-date contact list for your messaging needs.

Available Methods

Retrieve All Contacts

Get a complete list of all WhatsApp contacts available in your channel.
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
  ->allContact();
The allContact method supports pagination to efficiently handle large contact lists. If not specified, default values are used (limit: 100, offset: 0).

Get Contact Details

Retrieve detailed information about a specific contact.
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
  ->contact(
    contactId: 'xxx@c.us'
  )
  ->detail();
Contact details may vary depending on privacy settings and whether the contact is in your address book.

Get Contact Profile Picture

Retrieve the profile picture of a specific contact.
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
  ->contact(
    contactId: 'xxx@c.us'
  )
  ->picture();
If a contact doesn’t have a profile picture set, a default placeholder image URL may be returned.

Common Use Cases

Use the allContact method to create a searchable directory of all your WhatsApp contacts, complete with profile pictures and contact details.
Before sending messages, use the detail method to verify that a contact exists and is available on WhatsApp.
Retrieve contact details to personalize your messages with the recipient’s name or other information.
Enhance your chat interface by displaying contact profile pictures alongside messages.

Error Handling

{
  "success": false,
  "message": "Contact not found",
  "error_code": "CONTACT_NOT_FOUND"
}