Our Powerful API

Start Here

Welcome Developer! Our API is simple and robust. Just follow the instruction given below to integrate it with your application. If you face any issue or would like to report any bugs kindly mail us.

Getting Started

Pushify API is robust and provides almost all features you could do from your dashboard. Some of the features are listed below

  • Send Push Notifications
  • Manage Categories
  • Schedule Pushes
  • Manage Subscriptions and more
This document provides detailed instructions on how to use every feature.

How it works

Our API is of two types. This is explained in the following sections. To consume the API service, you should register in our application first. After registration there is no restriction on API. You can integrate our API to any third party applications like blogs, e-commerce applications, educational application, new application etc.

After registering into our application, to start using our API you should generate Token first. Considering the security issues, it is good practice to generate token first and later use the same in integration. Token will get expired in 180 days. You can generate Token as many times as you want

Generate Token

You need to send a post request to our servers to get a Token. You should provide your account email and password to get it

ENDPOINT

https://pushify.com/api/authenticate

PARAMETERS
email
This is the email that you give in your registration process
pass
Your account password
CALL
curl --data "email=yourmail@example.com&pass=yourpassword" https://pushify.com/api/authenticate
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/authenticate");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "email=your_email&pass=your_password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	id: your_id,
	email: your_email,
	token: your_token  // This is the token you need to copy
}
// Invalid Email
{
	success: false,
	message: "Invalid email"
}

// Invalid Password
{
	success: false,
	message: "Invalid password"
}
// Error
{
	success: false,
	message: "Something went wrong"
}

API Types

We currently support two kinds of APIs.

  1. Javascript API
  2. REST API

Using Javascript API you can integrate the opt-in, send push, unsubscribe operations. You can use REST API to do actions like sending a push, schedule a push, manage categories etc.

Javascript Library

Set up Library

First things first. You need to include our library to your websites head section. You need to know your account id to do this. After logging in navigate to Settings > Account to get it. You can get the same code from Get Code section of your dashboard.

HTML
<script type="text/javascript" src="https://<YOUR_SUBDOMAIN>.pushify.com/script.js?category=<CATEGORY_ID>" />

Show Opt-in popup

To show opt in pop up (push notification permission popup), please use the following calls

JAVASCRIPT
pushify.optin(function(subscriber_id){
	 // Store it to your database
});

Hide Opt-in popup

Hide the optin (push notification permission popup) using following call

JAVASCRIPT
pushify.hide_optin();  // It just hides the popup box

Send Push Notification

Send a push notification to your subsriber/s using following call

JAVASCRIPT
// Send to a subscriber
pushify.send(subscriber_id, {
	title: 'A awesome title',
	message: 'Your push body',
	category: category_id
}, function(response){
	 // Gives you push details. Save it to your database
}); 

// Send to all subscribers
pushify.send(null, {
	title: 'A awesome title',
	message: 'Your push body',
	category: category_id
}, function(response){
	 // Gives you push details. Save it to your database
});

Check for Delivery

Check whether a push notification is delivered to the subscriber

JAVASCRIPT
pushify.delivered(push_id, function(err, is_delivered){
	 // Contains a value if there is some error or null
	 // Boolean. True if delivered or false
});

Check for Click

Check whether a push notification is clicked by the subscriber

JAVASCRIPT
pushify.clicked(push_id, function(err, is_clicked){
	 // Contains a value if there is some error or null
	 // Boolean. True if clicked or false
});

Unsubscribe the user

Unsubscribe the user from you account

JAVASCRIPT
pushify.unsubscribe();

Render Buttons

You can render the Subscribe and Unsubscribe buttons. You can configure these buttons from your dashboard. Use following call to render it accordingly.

Subscribe button if user is not subscribed and vice verse
JAVASCRIPT
pushify.render();

REST API

Fetch a Push

Fetch a push notification by its id

ENDPOINT

https://pushify.com/api/v1

URL DATA
push_id
Push notifications id that need to be fetched
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" -X GET https://pushify.com/api/v1/push/<PUSH_ID>
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/push/<PUSH_ID>");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	push: push_data // Save the push information to your servers
}
// Error
{
	success: false,
	message: "Please give valid push id"
}

Send a Push

Send a push notification by following call

ENDPOINT

https://pushify.com/api/v1

POST DATA
title
Your push notification title
message
Push notification body
url
Url that need to be redirected when subscriber clicks the notification
logo
Notification logo
is_feed
If the notification need to be displayed in timeline, put 1 else 0
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" --data "title=Push+Title&message=Push+Message&url=encoded_url&logo=encoded_logo_url&is_feed=1" https://pushify.com/api/send-push
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/send-push");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "title=Push+Title&message=Push+Message&url=encoded_url&logo=encoded_logo_url&is_feed=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	push: push_data // Save the information to your servers
}

Schedule a Push

Schedule a push notification. It is similar to sending a push

ENDPOINT

https://pushify.com/api/v1

POST DATA
title
Your push notification title
body
Push notification body
url
Url that need to be redirected when subscriber clicks the notification
logo
Notification logo
is_feed
If the notification need to be displayed in timeline, put 1 else 0
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" --data "title=Push+Title&body=Push+Message&url=encoded_url&logo=encoded_logo_url&is_feed=1" https://pushify.com/api/send-schedule-push
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/send-schedule-push");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "title=Push+Title&body=Push+Message&url=encoded_url&logo=encoded_logo_url&is_feed=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	message: "Successfully push has been scheduled!",
	push: push_data // Save the information to your servers
}
// Error
{
	success: false,
	message: "Please provide valid details!"
}

Add Category

Add a new category to your account using following call

ENDPOINT

https://pushify.com/api/v1

POST DATA
title
Category title. It removes all special charecters and spaces
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" --data "title=CategoryTitle" https://pushify.com/api/category
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/category");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "title=CategoryTitle");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	message: "Successfully category added",
	category: category_data // Save the information to your servers
}
// Error
{
	success: false,
	message: "Please give valid title"
}

Fetch all Categories

Get all categories list

ENDPOINT

https://pushify.com/api/v1

CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" -X GET https://pushify.com/api/category
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/category");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	list: list_data // Save the information to your servers
}

Fetch a Category

Fetch a category details

ENDPOINT

https://pushify.com/api/v1

URL DATA
category_id
Your category id
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" -X GET https://pushify.com/api/category/<CATEGORY_ID<
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/send-push");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	category: category_data // Save the information to your servers
}
// Error
{
	success: false,
	message: "Please give valid category id"
}

Update a Category

Update existing category using following call

ENDPOINT

https://pushify.com/api/v1

URL DATA
category_id
Your existing category id
PUT DATA
title
Your category new title
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" -X PUT -d title="New_Title" https://pushify.com/api/category/<CATEGORY_ID>
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/category/<CATEGORY_ID>");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "title=New_Title");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	message: "Successfully category updated",
	category: category_data // Save the information to your servers
}
// Error in category id
{
	success: false,
	message: "Please give valid category id"
}

// Error in title
{
	success: false,
	message: "Please give valid data"
}

Subscribe a Category

You can add a subscriber to existing category by following call

ENDPOINT

https://pushify.com/api/v1

URL DATA
category_id
Your existing category id
subscriber_id
Your subscriber id
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" https://pushify.com/api/category/<CATEGORY_ID</subscriber/<SUBSCRIBER_ID>
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/category/<CATEGORY_ID>/subscriber/<SUBSCRIBER_ID>");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	message: "Successfully subscriber added to the category",
	subscriber: subscriber_data // Save the information to your servers
}
// Subscriber already exist in the category
{
	success: false,
	message: "Subscriber already exist in the category"
}

// Error in category id
{
	success: false,
	message: "Please give valid category id"
}
// Error
{
	success: false,
	message: "Some error occurred. Please try again"
}

Unsubscribe a Category

Remove existing subscriber from a category

ENDPOINT

https://pushify.com/api/v1

URL DATA
category_id
Your existing category id
subscriber_id
Your subscriber id
CALL
curl -H "Token: <YOUR_AUTHENTICATION_TOKEN>" -X DELETE https://pushify.com/api/v1/category/<CATEGORY_ID>/subscriber/<SUBSCRIBER_ID>
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://pushify.com/api/v1/category/<CATEGORY_ID>/subscriber/<SUBSCRIBER_ID>");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Token: <YOUR_AUTHENTICATION_TOKEN>'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);
RESPONSE
// Success Message
{
	success: true,
	push: "Successfully subscriber removed from the category"
}
// Error
{
	success: false,
	message: "Please provide valid details!"
}

Copyrights ©2017 intelligentidiots tech pvt. ltd.

0
Pushes sent till now