Mobile app hooks
This page lists the 3 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.
addochat_app_url
FilterSince 0.2.0 Runs in src/App/App.php.
Filters the address of the mobile app (for example on another domain that serves the same site).
| Argument | Type | Description |
|---|---|---|
$url | string | Address of the app. |
add_filter( 'addochat_app_url', function ( $url ) {
return $url;
} );
addochat_push_payload
FilterSince 0.2.0 Runs in src/Push/Sender.php.
Filters a push notification before it goes to a device. Return false to send nothing.
| Argument | Type | Description |
|---|---|---|
$payload | array<string, mixed>|false | Title, body, url (the app with the conversation), tag (one notification per conversation) and badge (number on the app icon). |
$conversation | array<string, mixed> | Conversation. |
$event | string | waiting (a chat waits for a colleague) or message (a visitor wrote in a chat of this colleague). |
$user_id | int | Colleague the device belongs to. |
add_filter( 'addochat_push_payload', function ( $payload, $conversation, $event, $user_id ) {
return $payload;
}, 10, 4 );
addochat_push_sent
ActionSince 0.2.0 Runs in src/Push/Sender.php.
Fires after a push notification went to the push service of a device.
| Argument | Type | Description |
|---|---|---|
$status | int | HTTP status of the push service (201 accepted, 404 or 410 gone, 0 not sent). |
$user_id | int | Colleague the device belongs to. |
$event | string | waiting, message or test. |
$conversation | array<string, mixed> | Conversation, empty for a test. |
add_action( 'addochat_push_sent', function ( $status, $user_id, $event, $conversation ) {
// ...
}, 10, 4 );