Endpoint notifications web, push

hello. Is there any endpoint in traccar that I can send notification to the client on my system. I'm not talking about trackers sending notifications, but from outside I can send PUSH notifications through the traccar manager ?

I tried but without success. por http://$traccar_host:$traccar_port/api/notifications/

I tried but without success.
https://www.traccar.org/api-reference/#tag/Notifications/paths/~1notifications/post

Anton Tananaev2 months ago

No.

Anton Tananaev2 months ago

great . thank's --> https://github.com/traccar/traccar/commit/9e0c4c5504df985f7b0292042be9d58253450b10

I have a page ready in PHP to send SMS directly from the TRACCAR SMS GATEWAY application. want me to send it to you. Then you can use it on the website as an example of integration if you want.

Warning: file_get_contents(http://84.46.255.171:8082/api/notifications/send/): Failed to open stream: HTTP request failed! HTTP/1.1 405 Method Not Allowed

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

// TRACCAR API access credentials
$api_url = 'http://84.46.255.171:8082/api/notifications/send/';
$api_username = 'user_email';
$api_password = 'uer_pass';


$userIds = array(); // IDs of the users you want to send the notification to
$message = 'Your push message here.';

// Test notification data
$data = array(
    'userIds' => $userIds,
    'message' => array(
        'type' => 'web',
        'text' => $message
    )
);

$options = array(
    'http' => array(
        'method'  => 'POST',
        'header'  => "Content-Type: application/json\r\n" ."Authorization: Basic " . base64_encode("$api_username:$api_password"),
        'content' => json_encode($data)
    )
);

$context  = stream_context_create($options);
$response = file_get_contents($api_url, false, $context);

if ($response !== false) {
    echo "Test push notification sent successfully.";
} else {
    echo "Error sending test push notification.";
}

?>

error access not permitted. When released, let me know to test.

please. I just wanted to know if ENDPOINT is really this one. if you need any additional variables. If you can help I would appreciate it. If there are any costs, you can email me and I will pay for the information.

/api/notifications/send/{UserId},{Message}
Anton Tananaev2 months ago

Where did you get this from? Check what the official app sends.

If you need paid support, you can always email us. Check support page.