Schedule Push#

Getting Started#

Introduction

This endpoint is used to create new notifications and can be scheduled for it to be sent. The request method of this call needs to be a "POST". The title, message, URL and other option of the notification have to be scheduled as POST parameters to the API endpoint.

Request URL

https://api.pushengage.com/apiv1/notifications

Method

POST

Request Parameters

Required Parameters

Parameter Name Parameter Type Description
notification_title String Title of the push notification.
notification_message String The message to be displayed in the push notification.
notification_url String URL to open upon clicking on the push notification.

Optional Parameters

Parameter Name Parameter Type Description
image_url String Image to be displayed in the Push Notification.
profile_id Array of String A profile id is unique for a customer in your database. Notifications will be sent to only those devices have this profile id.
include_segments Array of String Include_segments accepts value of array of segment_id. Notifications will be sent to only those subscribers which are subscribed in this segment.
include_countries Array of String include_countries accepts value as array of country. Notifications will be sent to only those subscribers, which are subscribed from these countries.
include_states Array of String include_states accepts value as array of state. Notifications will be sent to only those subscribers, which are subscribed from these states.
include_cities Array of String include_cities accepts value as array of city. Notifications will be sent to only those subscribers, which are subscribed from these cities.
include_device_types Array of String include_device_types accepts value as array of device. Notifications will be sent to only those subscribers, which are subscribed from these devices.
include_browsers Array of String include_browsers accepts value as array of browser. Notifications will be sent to only those subscribers, which are subscribed from these browsers.
require_interaction Number This defines the notification duration on browsers.
notification_expiry Number This is the expiry time for a notification. The maximum value is 28 days.
subscriber_hash Array of String A subscriber hash is unique for a subscriber in our database. Notifications will be sent to only the device having this subscriber hash.
big_image_url String The URL of an image to be displayed as part of the notification.
notification_type String This defines the notification status, such as now, later or, draft. In this case, notification_type has always been "later".
valid_from_utc String This defines sent time of schedule notification. This is valid only notification_type is later.

Response Objects

Required Object

Property Name Property Type Description
success Boolean To denote whether push request succeeded or not. Values can be 'true' or 'false'.
Notification_id Number To denote unique id of notification.

Optional Object

Property Name Property Type Description
message String Present in case of failure. Used to denote reason of failure.

Schedule Sample Push#

This push notification requires these parameters; notification_title, notification_message, notification_url, notification_type and valid_from_utc. The title should not exceed 45 characters, message should not exceed 73 characters, URLs should be W3C formatted, notification_type value should be "later" and valid_from_utc should be in the "YYYY-MM-DD hh:mm:ss" format.

Note

valid_from_utc taking value as your local date and time, the format should be "YYYY-MM-DD hh: mm:ss" (eg 1997-07-16 19:20:30) in 24 hours.
where:
YYYY = four-digit year
MM = two-digit month (01=January, etc.)
DD = two-digit day of month (01 through 31)
hh = two digits of hour (00 through 23) (am/pm NOT allowed)
mm = two digits of minute (00 through 59)
ss = two digits of second (00 through 59)

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 123456
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Image#

Push with a custom notification image. This image replaces your site logo in the notifications. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc and image_url.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&image_url=your_image_path/image.png'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&image_url=your_image_path/image.png",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234560
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Profile Id#

Notifications will be sent to only those devices which has this profile id. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc and profile_id.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&profile_id[0]=<profile_id>&profile_id[1]=<profile_id>'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&profile_id[0]=<profile_id>&profile_id[1]=<profile_id>",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234561
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "No Subcribers Found for the given profile_id"
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Segment#

Scheduled Notifications will be sent to only those subscribers which are subscribed to this segment. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc and include_segments.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com¬ification_type=later&valid_from_utc=<your_schedule_time>&include_segments[0]=123456'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com¬ification_type=later&valid_from_utc=<your_schedule_time>&include_segments[0]=123456",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234562
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Geo segmentation#

Scheduled Notifications will be sent to only those subscribers which are subscribed from these geos. For this push notification the required parameters are -

  • notification_title
  • notification_message
  • notification_url
  • include_countries
  • include_states
  • include_cities

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&include_countries[0]=countryname&include_states[0]=statename&include_cities[0]=cityname'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&include_countries[0]=countryname&include_states[0]=statename&include_cities[0]=citiesname",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 12348
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Device Segmentation#

Scheduled Notifications will be sent to only those subscribers which are subscribed from these devices. For this push notification the required parameters are -

  • notification_title
  • notification_message
  • notification_url
  • include_device_types

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&include_device_types[0]=desktop'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&include_device_types[0]=desktop",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 12348
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Browser Segmentation#

Scheduled Notifications will be sent to only those subscribers which are subscribed from these browsers. For this push notification the required parameters are -

  • notification_title
  • notification_message
  • notification_url
  • include_browsers

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&include_browsers[0]=chrome'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&include_browsers[0]=chrome",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 12348
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Require Interaction#

This feature is available for Chrome 47 and above versions only. For the chrome browser below version 47 default notification duration is 20 seconds. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc and require_interaction, its value should be 0 or 1. If require_interaction value is 0 means notification duration is 20 seconds and 1 means notification duration is 28 days. The require_interaction default value is 1.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&require_interaction=0'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&require_interaction=0",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234563
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Notification Expiry#

This defines the expiry time for a notification. If a user is not available online with a browser running, then the notification will be retried until expiration time. The maximum and default value is 1 month. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc and notification_expiry, its value should be in minutes.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&notification_expiry=10'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&notification_expiry=10",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234564
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Subscriber Hash#

Scheduled Notifications will be sent to only the device having this subscriber hash. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc and subscriber_hash.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&subscriber_hash[0]=<subscriber_hash>&subscriber_hash[1]=<subscriber_hash>&subscriber_hash[2]=<subscriber_hash>'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&subscriber_hash[0]=<subscriber_hash>&subscriber_hash[1]=<subscriber_hash>&subscriber_hash[2]=<subscriber_hash>",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234565
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "No Subcribers Found for the given subscriber_hash"
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Multi Action Notification#

Push with multi action in each notification, which can target users. You can use custom image for each call to action. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc, multi_element_title1, multi_element_url1, multi_element_image1, multi_element_title2, multi_element_url2 and multi_element_image2.

Example#

Request

Case a: Schedule Push Notification with One Action Button

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&multi_element_title1=Men&multi_element_url1=http://www.example.com/men.html&multi_element_image1=http://www.example.com/image.png'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&multi_element_title1=Men&multi_element_url1=http://www.example.com/men.html&multi_element_image1=http://www.example.com/image.png",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Case b: Schedule Push Notification with Two Action Button

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&multi_element_title1=Men&multi_element_url1=http://www.example.com/men.html&multi_element_image1=http://www.example.com/men.png&multi_element_title2=Women&multi_element_url2=http://www.example.com/women.html&multi_element_image2=http://www.example.com/women.png'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&multi_element_title1=Men&multi_element_url1=http://www.example.com/men.html&multi_element_image1=http://www.example.com/men.png&multi_element_title2=Women&multi_element_url2=http://www.example.com/women.html&multi_element_image2=http://www.example.com/women.png",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Note

multi_element_image1 and multi_element_image2 are optional parameters.

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234566
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Schedule Push with Big Image#

Schedule a Push notification with big image. This image to be displayed as part of the notification. For this push notification the required parameters are; notification_title, notification_message, notification_url, notification_type, valid_from_utc and big_image_url.

Example#

Request

  • cURL
  • PHP
curl -X POST
-H "api_key: <your_pushengage_api_key>"
-H "Content-Type: application/x-www-form-urlencoded"
-d 'notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&big_image_url=your_image_path/image.png'
"https://api.pushengage.com/apiv1/notifications"
<?php

    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.pushengage.com/apiv1/notifications",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "notification_title=this is title of notification&notification_message=this is message of notification&notification_url=http://www.example.com&notification_type=later&valid_from_utc=<your_schedule_time>&big_image_url=your_image_path/image.png",
      CURLOPT_HTTPHEADER => array(
        "api_key: <your_pushengage_api_key>",
        "cache-control: no-cache",
        "content-type: application/x-www-form-urlencoded"
      ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
?>

Response

  • 200 OK
  • 401 Unauthorized
  • 400 Bad Request
  • 400 Bad Request
  • 400 Bad Request
  • 500 Internal Server Error
{
  "success": true,
  "notification_id": 1234569
}
{
  "success": false,
  "message": "API KEY Invalid"
}
{
  "message": "The Title field is required.",
  "success": false
}
{
  "message": "The Message field is required.",
  "success": false
}
{
  "message": "The URL field is required.",
  "success": false
}
{
  "success": false,
  "message": "sending notification failed"
}

Note

Schedule your notification with combination of optional parameters according to your requirements.