Skip to content

Update Session

Update the configuration of a WhatsApp session.

Usage

The Session facade's update method may be used to update session configuration. By default, it updates the default session. You can also specify a session name to update a specific session.

php
use NjoguAmos\Waha\Facades\Session;
use NjoguAmos\Waha\Dto\SessionUpdateData;

$data = new SessionUpdateData(
    apps: [['app' => 'calls', 'enabled' => true]],
);

/** @var \Saloon\Http\Response $session */
$session = Session::update(data: $data);
php
use NjoguAmos\Waha\Facades\Session;
use NjoguAmos\Waha\Dto\SessionUpdateData;

$data = new SessionUpdateData(
    apps: [['app' => 'calls', 'enabled' => true]],
);

/** @var \Saloon\Http\Response $session */
$session = Session::update(data: $data, session: 'custom-session');

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 as an array or the dtoOrFail method to retrieve a SessionData DTO:

php
/** @var \Saloon\Http\Response $session */

$session->status(); // 201
$session->json();   // ["name" => "default", "status" => "WORKING", ...]
php
use NjoguAmos\Waha\Facades\Session;

/** @var \NjoguAmos\Waha\Dto\SessionData $session */
$session = $session->dtoOrFail();

Engines

WEBJSWPPNOWEBGOWS

References

Released under the MIT License.