{"_id":"55e58d81f493c11700584318","category":{"_id":"55e58d1bd101191900f30b1d","version":"55e58b63d101191900f30b16","__v":13,"pages":["55e58d27191aa90d0052b52f","55e58d56191aa90d0052b531","55e58d6ff493c11700584315","55e58d81f493c11700584318","55e59b9bd101191900f30b75","55e59c1ff11ba80d003238f1","55e7325f2d0d3021000db050","55e732ca58e25f35001437a6","55e7339e2d0d3021000db052","55e734aa7991b92100b209ed","55f7028ba7ceef0d00251c19","56669144ce8caf0d006018b6","56d04587376b040b005b2f7d"],"project":"55e58b63d101191900f30b13","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-01T11:33:47.501Z","from_sync":false,"order":2,"slug":"rest-api","title":"REST API"},"user":"5554788cb450630d00041dbc","editedParams2":true,"parentDoc":null,"version":{"_id":"55e58b63d101191900f30b16","__v":3,"project":"55e58b63d101191900f30b13","createdAt":"2015-09-01T11:26:27.668Z","releaseDate":"2015-09-01T11:26:27.668Z","categories":["55e58b65d101191900f30b17","55e58d16f493c11700584314","55e58d1bd101191900f30b1d"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":11,"editedParams":true,"githubsync":"","project":"55e58b63d101191900f30b13","updates":["5a556ba16ecf14003270ad77"],"next":{"pages":[],"description":""},"createdAt":"2015-09-01T11:35:29.440Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"//Sample JSON Object for subscriber_list parameter\n\n{\n    \"subscriber_list\": [\n        \"0001\",\n        \"0002\",\n        \"0003\",\n        \"0004\"\n    ]\n}","language":"text","name":""},{"code":"curl -H \"Authorization: key=<insert api token here>\" --data \"title=Testing&message=Hello&url=https://pushcrew.com&subscriber_list={\\\"subscriber_list\\\":[\\\"2169a28b2fcb0174eea0e6c771dbf754\\\",\\\"346108e3e9d361c1ee10ebdb2e8bb98d\\\"]}\" https://pushcrew.com/api/v1/send/list","language":"curl"},{"code":"<?php\n\n    $title = 'Title of Notification';\n\t  $message = 'Message of Notification';\n    $url = 'https://pushcrew.com';\n\n    $subscriberList = Array();\n    $subscriberList[] = '8fcd1d68c82dd39d65ef8ea9a7948bbe';\n    $subscriberList[] = '5ef8ea9a7948bbe8fcd1d68c82dd39sx';\n\n    $subscriberListArray = Array();\n\t  $subscriberListArray['subscriber_list'] = $subscriberList;\n\n\t  $subscriberListJsonString = json_encode($subscriberListArray);\n    \n    $apiToken = '<insert your api token here>';\n\n    $curlUrl = 'https://pushcrew.com/api/v1/send/list';\n    \n    //set POST variables\n    $fields = array(\n      'title' => $title,\n      'message' => $message,\n      'url' => $url,\n      'subscriber_list' => $subscriberListJsonString\n\t\t);\n\n    $httpHeadersArray = Array();\n    $httpHeadersArray[] = 'Authorization: key='.$apiToken;\n\n    //open connection\n    $ch = curl_init();\n\n    //set the url, number of POST vars, POST data\n    curl_setopt($ch, CURLOPT_URL, $curlUrl);\n    curl_setopt($ch, CURLOPT_POST, true);\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));\n    curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeadersArray);\n\n    //execute post\n    $result = curl_exec($ch);\n\n    $resultArray = json_decode($result, true);\n\n    if($resultArray['status'] == 'success') {\n        //success\n        //echo $resultArray['request_id']; //ID of Notification Request\n    }\n    else if($resultArray['status'] == 'failure') {\n        //failure\n    }\n    else {\n        //failure\n    }\n\n?>","language":"php"}]},"method":"post","results":{"codes":[{"status":200,"language":"json","code":"{\n    \"status\": \"success\",\n    \"request_id\": 123\n}","name":""},{"status":401,"language":"json","code":"{\n    \"message\": \"You are not authorized\"\n}","name":""},{"status":400,"language":"json","code":"{\n    \"status\": \"failure\",\n    \"message\": \"Title can have a maximum of 35 chars\"\n}"},{"status":400,"language":"json","code":"{\n    \"status\": \"failure\",\n    \"message\": \"Message can have a maximum of 80 chars\"\n}"},{"status":400,"language":"json","code":"{\n    \"status\": \"failure\",\n    \"message\": \"URL is not valid\"\n}"},{"status":500,"language":"json","code":"{\n    \"status\": \"failure\",\n    \"message\": \"Oops. Something snapped. Please try again after some time\"\n}"},{"status":400,"language":"json","code":"{\n  \"status\":\"failure\",\n  \"message\":\"Invalid subscriber Ids provided.\",\n  \"invalid_list\":[\"invalid-id-1\", \"invalid-id-2\"]\n}"}]},"settings":"","auth":"required","params":[{"_id":"55e59b43f493c11700584338","ref":"","in":"body","required":true,"desc":"To be sent as a POST Parameter. Title of the Push Notification. Maximum of 35 chars.","default":"","type":"string","name":"title"},{"_id":"55e59b43f493c11700584337","ref":"","in":"body","required":true,"desc":"To be sent as a POST Parameter. Message to be displayed in the Push Notification. Maximum of 80 chars.","default":"","type":"string","name":"message"},{"_id":"55e59b43f493c11700584336","ref":"","in":"body","required":true,"desc":"To be sent as a POST Parameter. URL to open upon clicking the push notification","default":"","type":"string","name":"url"},{"_id":"55e734267991b92100b209ec","ref":"","in":"body","required":true,"desc":"To be sent as a POST Parameter. JSON Object containing array of Subscriber ID's","default":"","type":"mixed","name":"subscriber_list"},{"_id":"5723b5e17d2fbc0e00c478eb","ref":"","in":"body","required":false,"desc":"URL of the icon to be shown in the notification. URL needs to be on HTTPS and needs to point to a 192 x 192 PNG. If this is not provided, the default company logo will be shown in the notification.","default":"","type":"string","name":"image_url"},{"_id":"5922fc02b90d7919007e6498","ref":"","in":"body","required":false,"desc":"This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. URL of the big image to be shown in the notification. URL needs to be on HTTPS and needs to point to an image file. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.","default":"","type":"string","name":"hero_image_url"},{"_id":"592300f5b90d7919007e6533","ref":"","in":"body","required":false,"desc":"This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the label of the first call-to-action button which will be shown in the notification. Maximum length of this parameter is 12 characters. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.","default":"","type":"string","name":"button_one_label"},{"_id":"592300f5b90d7919007e6532","ref":"","in":"body","required":false,"desc":"This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the URL which will open upon clicking the first call-to-action button shown in the notification. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.","default":"","type":"string","name":"button_one_url"},{"_id":"592300f5b90d7919007e6531","ref":"","in":"body","required":false,"desc":"This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the label of the second call-to-action button which will be shown in the notification. Maximum length of this parameter is 12 characters. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.","default":"","type":"string","name":"button_two_label"},{"_id":"592300f5b90d7919007e6530","ref":"","in":"body","required":false,"desc":"This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the URL which will open upon clicking the second call-to-action button shown in the notification. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.","default":"","type":"string","name":"button_two_url"},{"_id":"5857e8ea3ed9a719000c1258","ref":"","in":"body","required":false,"desc":"To be sent as a POST Parameter. This parameter is used to control the time up till which the notification should be attempted if the subscriber is offline. Pass the number of seconds elapsed after which the notification should not be sent. Default value(2419200) stands for 4 weeks.","default":"2419200","type":"int","name":"time_to_live"},{"_id":"5857e8ea3ed9a719000c1257","ref":"","in":"body","required":false,"desc":"To be sent as a POST parameter.  '1' denotes that the notification will remain on screen until it's clicked or closed. '0' denotes that the notification will auto-hide(if not clicked upon or closed) after 20 seconds.","default":"1","type":"int","name":"autohide_notification"}],"url":"/send/list"},"isReference":false,"order":5,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Response Parameters Description\"\n}\n[/block]\nStatus: To denote whether push request succeeded or not. Values can be 'success' or 'failure'\n\nRequest ID: Present in case of success. Used to denote id of notification request. The same is used for the Check Status of Notification Request API call.\n\nMessage: Present in case of failure. Used to denote reason of failure.","excerpt":"This endpoint is used to send a notification to a specified list of subscribers. The request method of this call needs to be \"POST\".\n\nThe title, message and url of the notification have to be sent as POST parameters to the API endpoint.\n\nURL of the image to be shown in the notification needs to point to a 192 x 192 PNG. If this is not provided, the default company logo will be shown in the notification.","slug":"send-to-a-list-of-subscribers","type":"endpoint","title":"Send to a List of Subscribers"}

postSend to a List of Subscribers

This endpoint is used to send a notification to a specified list of subscribers. The request method of this call needs to be "POST". The title, message and url of the notification have to be sent as POST parameters to the API endpoint. URL of the image to be shown in the notification needs to point to a 192 x 192 PNG. If this is not provided, the default company logo will be shown in the notification.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

title:
required
string
To be sent as a POST Parameter. Title of the Push Notification. Maximum of 35 chars.
message:
required
string
To be sent as a POST Parameter. Message to be displayed in the Push Notification. Maximum of 80 chars.
url:
required
string
To be sent as a POST Parameter. URL to open upon clicking the push notification
subscriber_list:
required
mixed
To be sent as a POST Parameter. JSON Object containing array of Subscriber ID's
image_url:
string
URL of the icon to be shown in the notification. URL needs to be on HTTPS and needs to point to a 192 x 192 PNG. If this is not provided, the default company logo will be shown in the notification.
hero_image_url:
string
This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. URL of the big image to be shown in the notification. URL needs to be on HTTPS and needs to point to an image file. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.
button_one_label:
string
This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the label of the first call-to-action button which will be shown in the notification. Maximum length of this parameter is 12 characters. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.
button_one_url:
string
This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the URL which will open upon clicking the first call-to-action button shown in the notification. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.
button_two_label:
string
This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the label of the second call-to-action button which will be shown in the notification. Maximum length of this parameter is 12 characters. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.
button_two_url:
string
This feature can only be used by business and enterprise accounts. To be sent as a POST parameter. This is the URL which will open upon clicking the second call-to-action button shown in the notification. Please note that this only works for Chrome subscribers. Firefox does not support this as of now.
time_to_live:
integer2419200
To be sent as a POST Parameter. This parameter is used to control the time up till which the notification should be attempted if the subscriber is offline. Pass the number of seconds elapsed after which the notification should not be sent. Default value(2419200) stands for 4 weeks.
autohide_notification:
integer1
To be sent as a POST parameter. '1' denotes that the notification will remain on screen until it's clicked or closed. '0' denotes that the notification will auto-hide(if not clicked upon or closed) after 20 seconds.

Examples


Result Format


Documentation

[block:api-header] { "type": "basic", "title": "Response Parameters Description" } [/block] Status: To denote whether push request succeeded or not. Values can be 'success' or 'failure' Request ID: Present in case of success. Used to denote id of notification request. The same is used for the Check Status of Notification Request API call. Message: Present in case of failure. Used to denote reason of failure.