Send a notification
curl --request POST \
--url https://pushctl.com/api/v1/notifications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recipients": {
"user_ids": [
"user-123",
"user-456"
]
},
"notification": {
"title": "Order ready",
"body": "Your order is ready for collection.",
"image_url": "<string>",
"action_url": "myapp://orders/123"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recipients: {user_ids: ['user-123', 'user-456']},
notification: {
title: 'Order ready',
body: JSON.stringify('Your order is ready for collection.'),
image_url: '<string>',
action_url: 'myapp://orders/123'
}
})
};
fetch('https://pushctl.com/api/v1/notifications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pushctl.com/api/v1/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 => json_encode([
'recipients' => [
'user_ids' => [
'user-123',
'user-456'
]
],
'notification' => [
'title' => 'Order ready',
'body' => 'Your order is ready for collection.',
'image_url' => '<string>',
'action_url' => 'myapp://orders/123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://pushctl.com/api/v1/notifications"
payload = {
"recipients": { "user_ids": ["user-123", "user-456"] },
"notification": {
"title": "Order ready",
"body": "Your order is ready for collection.",
"image_url": "<string>",
"action_url": "myapp://orders/123"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "<string>",
"notification": {
"title": "<string>",
"body": "<string>",
"image_url": "<string>",
"action_url": "<string>"
},
"data": {},
"options": {},
"target_users": 123,
"statistics": {
"users": 123,
"installations": 123,
"accepted": 123,
"received": 123,
"displayed": 123,
"opened": 123,
"failed": 123,
"skipped": 123
},
"created_at": "2023-11-07T05:31:56Z",
"processing_started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z"
},
"meta": {
"accepted": true
}
}{
"message": "Unauthenticated."
}{
"message": "This action is unauthorized."
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Notifications
Send a notification
Queues a notification for eligible installations belonging to the specified external users.
POST
/
api
/
v1
/
notifications
Send a notification
curl --request POST \
--url https://pushctl.com/api/v1/notifications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"recipients": {
"user_ids": [
"user-123",
"user-456"
]
},
"notification": {
"title": "Order ready",
"body": "Your order is ready for collection.",
"image_url": "<string>",
"action_url": "myapp://orders/123"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recipients: {user_ids: ['user-123', 'user-456']},
notification: {
title: 'Order ready',
body: JSON.stringify('Your order is ready for collection.'),
image_url: '<string>',
action_url: 'myapp://orders/123'
}
})
};
fetch('https://pushctl.com/api/v1/notifications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pushctl.com/api/v1/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 => json_encode([
'recipients' => [
'user_ids' => [
'user-123',
'user-456'
]
],
'notification' => [
'title' => 'Order ready',
'body' => 'Your order is ready for collection.',
'image_url' => '<string>',
'action_url' => 'myapp://orders/123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://pushctl.com/api/v1/notifications"
payload = {
"recipients": { "user_ids": ["user-123", "user-456"] },
"notification": {
"title": "Order ready",
"body": "Your order is ready for collection.",
"image_url": "<string>",
"action_url": "myapp://orders/123"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "<string>",
"notification": {
"title": "<string>",
"body": "<string>",
"image_url": "<string>",
"action_url": "<string>"
},
"data": {},
"options": {},
"target_users": 123,
"statistics": {
"users": 123,
"installations": 123,
"accepted": 123,
"received": 123,
"displayed": 123,
"opened": 123,
"failed": 123,
"skipped": 123
},
"created_at": "2023-11-07T05:31:56Z",
"processing_started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z"
},
"meta": {
"accepted": true
}
}{
"message": "Unauthenticated."
}{
"message": "This action is unauthorized."
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Authorizations
Use an application-scoped token with the ability required by the endpoint.
Headers
Stable key for safely retrying one logical send. Maximum 255 characters.
Maximum string length:
255Body
application/json
Was this page helpful?
⌘I