SAREpush
  • INTRODUCTION
  • Platform Support
  • JAVASCRIPT LIBRARY
    • Installing library on website
    • Installing library through GTM
    • Tagging a subscriber using library
    • Preview subscriber's tags in our platform.
    • Sending shopping cart events using library
  • REST API
    • Introduction
    • Retrieving a list of websites
    • Retrieving JS code for specific website
    • Creating campaign to all subscribers
    • Creating campaign to particular locations
    • Creating campaign to particular tags
    • Creating campaign to particular segments
    • Sending message to specific subscriber
    • Sending message to test subscribers
    • Retrieving a list of segments
    • Retrieving a list of locations
    • Retrieving a list of tags
    • Retrieving a list of subscribers
  • PLUGINS
    • Installing WordPress plugin
  • CAMPAIGNS
    • Delivery automation
      • Welcome notification
      • When leave website
      • When visit specific web page
      • When spend X time on specific web page
    • Delivery to audience
      • Send to all subscribers
      • Send to particular segments
      • Send to particular tags
      • Send to test segment
    • Delivery scheduling
      • Send at a particular time
      • Sent recurring
    • Message personalization
    • Message preview
    • Message time to live
    • Images and icons
  • User management
    • User Management
    • Permission table
  • Product feed
    • What is XML Product Feed?
Powered by GitBook
On this page
  1. REST API

Creating campaign to particular segments

To create campaign to subscribers in particular segments, submit a POST request to:

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

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

$url = "https://push-api.sare.pl/v1/campaigns/<YOUR_WEBSITE_UID>/segments";
$payload = [
    "segments" => [
        "Mobile Users", 
        "Subscribers from last 7 days"
    ],
    "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 "{\"segments\":[\"Mobile Users\",\"Subscribers from last 7 days\"],\"title\":\"Title of message\",\"body\":\"Body of message\",\"link\":\"https:\\/\\/sendflow.pl\",\"ttl\":604800}" \
     https://push-api.sare.pl/v1/campaigns/<YOUR_WEBSITE_UID>/segments

Response example

{
  "result": true
}

Read more about segments:

PreviousCreating campaign to particular tagsNextSending message to specific subscriber

Last updated 4 years ago

Send to particular segments