Creating campaign to particular segments
To create campaign to subscribers in particular segments, submit a POST request to:
1
https://push-api.sare.pl/v1/campaigns/<YOUR_WEBSITE_UID>/segments
Copied!
Body parameters
Description
segments
Array of segment(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>/segments";
2
$payload = [
3
"segments" => [
4
"Mobile Users",
5
"Subscribers from last 7 days"
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 "{\"segments\":[\"Mobile Users\",\"Subscribers from last 7 days\"],\"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>/segments
Copied!

Response example

1
{
2
"result": true
3
}
Copied!
Read more about segments:
Copy link
Contents