Skip to content

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

ParameterTypeRequiredDescription
chatIdstringYesChat ID ([email protected], 123@lid) or phone number (1231231231)
dataContactUpdateDataYesContact update data with firstName and lastName
sessionstringNoSession 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

WEBJSWPPNOWEBGOWS

References

Released under the MIT License.