{"_id":"59842451ff486d0037912355","project":"55e58b63d101191900f30b13","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"},"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","githubsync":"","__v":2,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-08-04T07:37:53.915Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"curl -H \"Authorization: key=<insert api token here>\" --data \"title=Testing&message=Hello&url=https://pushcrew.com&schedule=1&date=2017-08-04&time=12:00:00\" https://pushcrew.com/api/v1/send/segment/123","language":"curl"},{"code":"<?php\n\n    $title = 'Title of Notification';\n\t  $message = 'Message of Notification';\n    $url = 'https://pushcrew.com';\n    $segmentId = '123';\n\t\t$date = '2017-08-04'; // Needs to be according to UTC/GMT Timezone\n\t\t$time = '12:00:00'; // Needs to be according to UTC/GMT Timezone\n    \n    $apiToken = '<insert your api token here>';\n\n    $curlUrl = 'https://pushcrew.com/api/v1/send/segment/'.$segmentId;\n    \n    //set POST variables\n    $fields = array(\n      'title' => $title,\n      'message' => $message,\n      'url' => $url,\n      'schedule' => '1',\n      'date'=>$date,\n      'time'=>$time\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":[{"code":"{\n    \"status\": \"success\",\n    \"scheduled_notification_request_id\": 123,\n    \"message\": \"Your notification has been scheduled successfully.\"\n}","name":"","status":200,"language":"json"},{"language":"json","code":"{\n    \"message\": \"You are not authorized\"\n}","name":"","status":401},{"code":"{\n    \"status\": \"failure\",\n    \"message\": \"Date cannot be empty for scheduled notification\"\n}","language":"json","status":400},{"code":"{\n    \"status\": \"failure\",\n    \"message\": \"Time cannot be empty for scheduled notification\"\n}","language":"json","status":400},{"code":"{\n    \"status\": \"failure\",\n    \"message\": \"Notification can\\'t be scheduled before current time.\"\n}","language":"json","status":400},{"code":"{\n    \"status\": \"failure\",\n    \"message\": \"Oops. Something snapped. Please try again after some time\"\n}","language":"json","status":500}]},"settings":"","auth":"required","params":[{"_id":"55e591f0f493c11700584324","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":"55e591f0f493c11700584323","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":"55e591f0f493c11700584322","ref":"","in":"body","required":true,"desc":"To be sent as a POST Parameter. URL to open upon clicking of the push notification.","default":"","type":"string","name":"url"},{"_id":"598420cd9b5a0c0019ab6e27","ref":"","in":"body","required":true,"desc":"To be sent as '1'. This is an integer used to denote that this notification needs to be scheduled.","default":"","type":"int","name":"schedule"},{"_id":"598420cd9b5a0c0019ab6e26","ref":"","in":"body","required":true,"desc":"The date on which the scheduled notification should go out. Should be in YYYY-MM-DD format.","default":"","type":"yyyy-mm-dd","name":"date"},{"_id":"598420cd9b5a0c0019ab6e25","ref":"","in":"body","required":true,"desc":"The time on which the scheduled notification should go out. This needs to be according to UTC/GMT timezone. Format: HH:MM:SS","default":"","type":"string","name":"time"},{"_id":"5723b533b1f99d0e00086b08","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":"5922ff75b90d7919007e64e7","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":"5922ff75b90d7919007e64e6","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":"5922ff75b90d7919007e64e5","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":"5922ff75b90d7919007e64e4","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":"5857e85bbfc4771b00805462","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":"5857e85bbfc4771b00805461","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/segment/:segmentId"},"isReference":false,"order":9,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Response Description:\"\n}\n[/block]\nScheduled Notification Request ID: An integer sent to identify the scheduling request sent by you to our API.\n\nStatus: To denote whether push request succeeded or not. Values can be 'success' or 'failure'\n\nMessage: Used to denote success or reason of failure.","excerpt":"This endpoint is used to schedule a notification for a segment of subscribers. The request method of this call needs to be \"POST\". This feature is only available for premium plans and above.","slug":"schedule-for-a-segment","type":"endpoint","title":"Schedule a notification for a Segment"}

postSchedule a notification for a Segment

This endpoint is used to schedule a notification for a segment of subscribers. The request method of this call needs to be "POST". This feature is only available for premium plans and above.

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 of the push notification.
schedule:
required
integer
To be sent as '1'. This is an integer used to denote that this notification needs to be scheduled.
date:
required
yyyy-mm-dd
The date on which the scheduled notification should go out. Should be in YYYY-MM-DD format.
time:
required
string
The time on which the scheduled notification should go out. This needs to be according to UTC/GMT timezone. Format: HH:MM:SS
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.
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 Description:" } [/block] Scheduled Notification Request ID: An integer sent to identify the scheduling request sent by you to our API. Status: To denote whether push request succeeded or not. Values can be 'success' or 'failure' Message: Used to denote success or reason of failure.