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

Error Handling

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