Sending message to specific subscriber

To send notification to specific subscriber, submit a POST request to:

https://push-api.sare.pl/v1/notifications/<YOUR_WEBSITE_UID>

Body parameters

Description

uid

Unique identifier of subscriber (required)

title

Title of message (required)

body

Body of message (required)

link

Link of message (required)

ttl

Notification lifetime (required)

icon

Url to icon (optional)

image

Url to image (optional)

PHP example

$url = "https://push-api.sare.pl/v1/notifications/<YOUR_WEBSITE_UID>";
$payload = [
    "uid" => "709c00f81e6bcde53d6751efe7d43c68",
    "title" => "Title of message",
    "body" => "Body of message",
    "link" => "https://sendflow.pl",
    "ttl" => 604800,
    "icon" => "https://your-cdn.pl/icon.png",
    "image" => "https://your-cdn.pl/image.png"
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Basic <YOUR_API_KEY>',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$result = curl_exec($ch);

Bash example

curl --include \
     --request POST \
     --header "Content-Type: application/json; charset=utf-8" \
     --header "Authorization: Basic <YOUR_API_KEY>" \
     --data-binary "{\"uid\":\"709c00f81e6bcde53d6751efe7d43c68\",\"title\":\"Title of message\",\"body\":\"Body of message\",\"link\":\"https:\\/\\/sendflow.pl\",\"ttl\":604800}" \
     https://push-api.sare.pl/v1/notifications/<YOUR_WEBSITE_UID>

Response example

{
  "result": true
}

Last updated