Access to SendPulse web push API is available only to holders of paid accounts.

Retrieving a list of sent push campaigns

To retrieve a list of sent push campaigns, submit a GET request to:

https://api.sendpulse.com/push/tasks

Request parameters:

limit Number of entries
offset Offset (indicates entry number to start from)

When using additional parameters, form a URL of the following format:

https://api.sendpulse.com/push/tasks/?limit=10&offset=2

Display 10 entries starting from the second entry

Sample response to retrieving a list of sent web push campaigns:

 

[
  {
    "id": "121",
    "title": "push title",
    "body": "push text",
    "website_id": "53",
    "send_date": "2015-12-17 14:44:47",
    "status": "13"
  }
]
 

Retrieving the total number of websites

To retrieve the total number of websites, a GET request is sent to:

https://api.sendpulse.com/push/websites/total

A sample response to retrieving the total number of websites:

 

{
  "total": 2
}
 

Retrieving a list of websites

To retrieve a list of websites, a GET request is sent to:

https://api.sendpulse.com/push/websites/

Request parameters:

limit Number of entries
offset Offset (indicates entry number to start from)

When using additional parameters, form a URL of the following format:

https://api.sendpulse.com/push/websites/?limit=10&offset=2

Sample response to retrieving a list of websites

 

[
  {
    "id": "53",
    "url": "www.test-site.com",
    "add_date": "2015-11-23 14:42:37",
    "status": "1"
  }
]
 

Retrieving a list of variables for a website

In order to retrieve a list of variables for a certain website, submit a GET request to:

https://api.sendpulse.com/push/websites/{id}/variables

Request parameters:

{id} Website ID

Sample response:

 

[
  {
    "id": "97",
    "name": "uname",
    "type": "string"
  }
]
 

Retrieving a list of website subscribers

In order to retrieve a list subscribers for a certain website, submit a GET request to:

https://api.sendpulse.com/push/websites/{id}/subscriptions

Request parameters:

{id} Website ID (required)
limit Number of entries
offset Offset (indicates entry number to start from)

When using additional parameters, form a URL of the following format.:

https://api.sendpulse.com/push/websites/{id}/subscriptions/?limit=10&offset=2

A sample response to retrieving a list of website subscribers:

 

[
  {
    "id": "1",
    "browser": "Chrome",
    "lang": "en",
    "variables": [],
    "status": "0"
  }
]
 

Retrieving the number of website subscribers

To retrieve the total number of website subscribers, submit a GET request to:

https://api.sendpulse.com/push/websites/{id}/subscriptions/total

Request parameters:

{id} Website ID (required)

A sample response:

{
  "total": 2
}
 

Activating/Deactivating a subscriber

To activate or deactivate a subscriber, a POST request is sent to:

https://api.sendpulse.com/push/subscriptions/state

Request parameters (required):

{id} Subscriber ID
state subscriber state trigger, 1 – activated, 0 – disabled

Sample response:

 

{
  "result": true
}
 

Creating a new Push campaign

To create a new push campaign, submit a POST request to:

https://api.sendpulse.com/push/tasks

Note that the limit is 1 message per 15 minutes for each website.

Use Automation360 toolset for triggered campaigns.

Required request parameters:

title Title
website_id Website ID
body Web push notification content
ttl Push notification lifetime

Optional request parameters:

link Navigation link; if it’s not specified, the website URL will be used
filter_lang Filter subscribers by language (example en)
filter_browser Filter subscribers by the browser; this parameter can take multiple values separated by commas (example – Chrome, Safari)
filter Segmentation by one of the variables
stretch_time Timespan during which the campaign must be completed. In seconds. If not specified, the default time (5 hours) applies.
send_data schedule a campaign for a specific date and time: Y-m-d H:i:s (example 2020-09-11 16:19:10)
image

to insert a larger image into the web-push notification, "image" parameter must include such a JSON string:{"name":"test.jpg","data":"file_content"}, where "test.jpg" - is the image name, and "file_content" - base64_encode(file contents), which can be obtained using PHP by "file_get_contents".

*the image must be in JPG, PNG, GIF format and within 200KB

icon

this parameter is used to insert a customized image of the standard size:
the parameter must include such a json string: {"name":"icon.jpg","data":"base64_file_content"}

where "icon.jpg" — is the image name and, а "base64_file_content" — contents of the file

Example of filter parameter structure:

 

{
  "variable_name": "uname",
  "operator": "or",
  "conditions": [
    {
      "condition": "likewith",
      "value": "a"
    },
    {
      "condition": "notequal",
      "value": "b"
    }
  ]
}

 

 

where:

variable_name Variable name
operator connecting operator only accepts ‘or’ or ‘and’ values
conditions Array of conditions
condition accepts following values
equal Completely equal
notequal Completely not equal
greaterthan More than
lessthan Less than
startwith Start with
endwith End with
likewith Contains
notlikewith Not contain

Sample server response to a successful creation of a push campaign:

 

{
  "result": true,
  "id": 1
}
 

Retrieving statistics on sent campaigns

To retrieve statistics on sent campaigns, submit a GET request to

https://api.sendpulse.com/push/tasks/{id}

Request parameters:

{id} wep push campaign id

Sample response to retrieving statistics on sent web push campaigns:

{
"id": "36",
"message": {
"title": "s",
"text": "s",
"link": "http://aaa.aaa" 
},
"website": "www.google.com",
"website_id": 53,
"status": 3,
"send": "21",
"delivered": "14",
"redirect": "13" 
}