Update Contact
Update a contact on your phone address book (and in WhatsApp).
Usage
You can use the Contact facade to update a contact.
php
use NjoguAmos\Waha\Facades\Contact;
use NjoguAmos\Waha\Dto\ContactUpdateData;
$data = new ContactUpdateData(firstName: 'John', lastName: 'Doe');
$contact = Contact::update(chatId: '[email protected]', data: $data);php
use NjoguAmos\Waha\Facades\Contact;
use NjoguAmos\Waha\Dto\ContactUpdateData;
$data = new ContactUpdateData(firstName: 'John', lastName: 'Doe');
$contact = Contact::update(chatId: '11231231231', data: $data);php
use NjoguAmos\Waha\Facades\Contact;
use NjoguAmos\Waha\Dto\ContactUpdateData;
$data = new ContactUpdateData(firstName: 'John', lastName: 'Doe');
$contact = Contact::update(chatId: '11231231231', data: $data, session: 'my-session');Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chatId | string | Yes | Chat ID ([email protected], 123@lid) or phone number (1231231231) |
data | ContactUpdateData | Yes | Contact update data with firstName and lastName |
session | string | No | Session name (defaults to waha.session config) |
Response
The response returned by the update method is an instance of Saloon\Http\Response. You may use the json method to retrieve the response:
php
/** @var \Saloon\Http\Response $response */
$response->status(); // 200
$response->json(); // ["success" => true]Phone Address Book Update Note
- If you have multiple WhatsApp apps installed on your phone, the API might only work with one account.
- You may need to make a few API requests with the same parameters and wait a few seconds between requests to update your phone address book.
Engines
| WEBJS | WPP | NOWEB | GOWS |
|---|---|---|---|
| ✅ | ✅ | ✅ | ❌ |