Retrieving a List of Sent Web Push Campaigns
To retrieve a list of sent web 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) |
from | Starting date |
to | Ending date |
website_id | Website ID set for a campaign |
*Must use such a format for dates: YYYY-MM-DD HH:MM:SS
The maximum number of entries in one reply is 100. Use the «offset» parameter to indicate the starting entry.
When using additional parameters, form a URL in the following format (the example shows how to retrieve 10 entries starting from the 2nd one):
https://api.sendpulse.com/push/tasks/?limit=10&offset=2 |
Display 10 entries starting from the second entry.
Sample response for retrieving a list of sent web push campaigns:
[
{
"id": 121,
"title": "push title",
"body": "push text",
"website_id": 53,
"from": "2015-11-17 14:44:47",
"to": "2015-12-23 19:42:27",
"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:
{
"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) |
subscription_date_from | Filter by date the subscribers were added (specify date and time from and to duration of time) set in format "YYYY-MM-DD" |
subscription_date_to | Filter by date the subscribers were added (specify date and time from and to duration of time) set in format "YYYY-MM-DD" |
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": 311003743,
"browser": "Firefox",
"lang": "en",
"os": "Linux",
"country_code": "UA",
"city": "Dnipro",
"variables": [],
"subscription_date": "2018-08-13 14:27:11",
"status": 1
},
{
"id": 311008277,
"browser": "Opera",
"lang": "en",
"os": "Linux",
"country_code": "UA",
"city": "Dnipro",
"variables": [],
"subscription_date": "2018-08-13 14:33:51",
"status": 1
}
]
Possible push subscrbers' statuses:
0 | deactivated |
1 | active |
6 | unsubscribed |
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
}
Retrieving Information About a Website
Submit a GET request to:
https://api.sendpulse.com/push/websites/info/{id} |
Request parameters:
id | Website ID |
A sample response:
{
"id": 111111,
"url": "yoursite.com",
"status": "active",
"icon": "https://login.sendpulse.com/img/my/push/push-default-icons/icon.png",
"add_date": "2017-11-09 13:08:37",
"total_subscribers": 1081,
"unsubscribed": 30,
"subscribers_today": 10,
"active_subscribers": 1051
}
Retrieving JS Code for a Website
Submit a GET request to:
https://api.sendpulse.com/push/websites/{id}/code |
Request parameters:
id | Website ID |
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 Web 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 the Automation360 toolset for triggered campaigns.
Required request parameters:
title | Title |
website_id | Website ID |
body | Web push notification content |
ttl | Push notification lifetime in seconds, max - 86400 sec (24 hours) |
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_region | Regional filter, accepts a JSON string with country codes, for instance ["UK"] |
filter_url | URL filter, accepts a JSON string of such format {"type":"include","search":"pu"} "type" can have three values - 'direct', 'include', 'exclude' when type equals 'direct' - search is an array of links, in other cases - "search" will be a regular string for search |
filter_subscription_date_from | Use "YYYY-MM-DD" format to specify starting and ending dates of the interval to filter subscribers by the date they were added to the list |
filter_subscription_date_to | Use "YYYY-MM-DD" format to specify starting and ending dates of the interval to filter subscribers by the date they were added to the list. |
filter | Segmentation by one of the variables |
stretch_time | Timespan in which the campaign must be completed. In seconds. If not specified, the default time (5 hours) applies. |
send_date | Schedule a campaign for a specific date and time: YYYY-MM-DD HH:MM:SS (example 2020-09-11 16:19:10) |
buttons | Insert a button to the campaign, accepts a JSON string, that lists buttons and their values, for example: [{"text":"Button1","link":"link1"}] ; *maximum two buttons |
image |
Insert a larger image into the web-push notification, "image" parameter must include such a JSON string *the image must be in the JPG, PNG or GIF format and less than 200KB |
icon |
This parameter is used to insert a custom image of a standard size: where |
Please note: you can add up to 10 filters for 1 campaign.
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 | Doesn 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 for 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
}
Web Push campaign statuses:
Code | Description |
0 | New campaign |
2 | In progress |
3 | Sent |
8 | Test campaign sent |
12 | No active recipients |
13 | Campaign creation in progress — copying subscriptions |
15 | Campaign awaiting results of A/B testing |
16 | Canceled by user |
30 | Archived |
Sign up with
Sign in with Facebook Sign in with Google