Creating campaign to particular locations
To create campaign to subscribers with particular tags, submit a POST request to:
1
https://push-api.sare.pl/v1/campaigns/<YOUR_WEBSITE_UID>/locations
Copied!
Body parameters
Description
locations
Array of location(s) (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

1
$url = "https://push-api.sare.pl/v1/campaigns/<YOUR_WEBSITE_UID>/locations";
2
$payload = [
3
"locations" => [
4
"Warsaw",
5
"Paris"
6
],
7
"title" => "Title of message",
8
"body" => "Body of message",
9
"link" => "https://sendflow.pl",
10
"ttl" => 604800,
11
"icon" => "https://your-cdn.pl/icon.png",
12
"image" => "https://your-cdn.pl/image.png"
13
];
14
15
$ch = curl_init();
16
curl_setopt($ch, CURLOPT_URL, $url);
17
curl_setopt($ch, CURLOPT_POST, true);
18
curl_setopt($ch, CURLOPT_HTTPHEADER, [
19
'Authorization: Basic <YOUR_API_KEY>',
20
'Content-Type: application/json'
21
]);
22
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
23
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
24
$result = curl_exec($ch);
Copied!

Bash example

1
curl --include \
2
--request POST \
3
--header "Content-Type: application/json; charset=utf-8" \
4
--header "Authorization: Basic <YOUR_API_KEY>" \
5
--data-binary "{\"locations\":[\"Warsaw\",\"Paris\"],\"title\":\"Title of message\",\"body\":\"Body of message\",\"link\":\"https:\\/\\/sendflow.pl\",\"ttl\":604800}" \
6
https://push-api.sare.pl/v1/campaigns/<YOUR_WEBSITE_UID>/locations
Copied!

Response example

1
{
2
"result": true
3
}
Copied!
Copy link
Contents