Send push notifications to user devices.
curl --request POST \
--url https://api.clix.so/api/v1/messages:send \
--header 'Content-Type: application/json' \
--header 'X-Clix-API-Key: <api-key>' \
--header 'X-Clix-Project-ID: <api-key>' \
--data '
{
"push_notifications": [
{
"target": {
"project_user_id": "<string>"
},
"title": "<string>",
"body": "<string>",
"image_url": "<string>",
"landing_url": "<string>"
}
]
}
'import requests
url = "https://api.clix.so/api/v1/messages:send"
payload = { "push_notifications": [
{
"target": { "project_user_id": "<string>" },
"title": "<string>",
"body": "<string>",
"image_url": "<string>",
"landing_url": "<string>"
}
] }
headers = {
"X-Clix-Project-ID": "<api-key>",
"X-Clix-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Clix-Project-ID': '<api-key>',
'X-Clix-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
push_notifications: [
{
target: {project_user_id: '<string>'},
title: '<string>',
body: JSON.stringify('<string>'),
image_url: '<string>',
landing_url: '<string>'
}
]
})
};
fetch('https://api.clix.so/api/v1/messages:send', 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://api.clix.so/api/v1/messages:send",
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([
'push_notifications' => [
[
'target' => [
'project_user_id' => '<string>'
],
'title' => '<string>',
'body' => '<string>',
'image_url' => '<string>',
'landing_url' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Clix-API-Key: <api-key>",
"X-Clix-Project-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.clix.so/api/v1/messages:send"
payload := strings.NewReader("{\n \"push_notifications\": [\n {\n \"target\": {\n \"project_user_id\": \"<string>\"\n },\n \"title\": \"<string>\",\n \"body\": \"<string>\",\n \"image_url\": \"<string>\",\n \"landing_url\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Clix-Project-ID", "<api-key>")
req.Header.Add("X-Clix-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.clix.so/api/v1/messages:send")
.header("X-Clix-Project-ID", "<api-key>")
.header("X-Clix-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"push_notifications\": [\n {\n \"target\": {\n \"project_user_id\": \"<string>\"\n },\n \"title\": \"<string>\",\n \"body\": \"<string>\",\n \"image_url\": \"<string>\",\n \"landing_url\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clix.so/api/v1/messages:send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Clix-Project-ID"] = '<api-key>'
request["X-Clix-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"push_notifications\": [\n {\n \"target\": {\n \"project_user_id\": \"<string>\"\n },\n \"title\": \"<string>\",\n \"body\": \"<string>\",\n \"image_url\": \"<string>\",\n \"landing_url\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"delivery_results": [
{
"message_id": "<string>",
"additional_params": {
"device_id": "<string>",
"fcm_message_id": "<string>",
"failure_reason": "<string>"
}
}
]
}"Invalid push notification parameters"Messages
Send Messages
This endpoint sends push notifications to one or more user devices.
POST
/
api
/
v1
/
messages:send
Send push notifications to user devices.
curl --request POST \
--url https://api.clix.so/api/v1/messages:send \
--header 'Content-Type: application/json' \
--header 'X-Clix-API-Key: <api-key>' \
--header 'X-Clix-Project-ID: <api-key>' \
--data '
{
"push_notifications": [
{
"target": {
"project_user_id": "<string>"
},
"title": "<string>",
"body": "<string>",
"image_url": "<string>",
"landing_url": "<string>"
}
]
}
'import requests
url = "https://api.clix.so/api/v1/messages:send"
payload = { "push_notifications": [
{
"target": { "project_user_id": "<string>" },
"title": "<string>",
"body": "<string>",
"image_url": "<string>",
"landing_url": "<string>"
}
] }
headers = {
"X-Clix-Project-ID": "<api-key>",
"X-Clix-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Clix-Project-ID': '<api-key>',
'X-Clix-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
push_notifications: [
{
target: {project_user_id: '<string>'},
title: '<string>',
body: JSON.stringify('<string>'),
image_url: '<string>',
landing_url: '<string>'
}
]
})
};
fetch('https://api.clix.so/api/v1/messages:send', 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://api.clix.so/api/v1/messages:send",
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([
'push_notifications' => [
[
'target' => [
'project_user_id' => '<string>'
],
'title' => '<string>',
'body' => '<string>',
'image_url' => '<string>',
'landing_url' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Clix-API-Key: <api-key>",
"X-Clix-Project-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.clix.so/api/v1/messages:send"
payload := strings.NewReader("{\n \"push_notifications\": [\n {\n \"target\": {\n \"project_user_id\": \"<string>\"\n },\n \"title\": \"<string>\",\n \"body\": \"<string>\",\n \"image_url\": \"<string>\",\n \"landing_url\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Clix-Project-ID", "<api-key>")
req.Header.Add("X-Clix-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.clix.so/api/v1/messages:send")
.header("X-Clix-Project-ID", "<api-key>")
.header("X-Clix-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"push_notifications\": [\n {\n \"target\": {\n \"project_user_id\": \"<string>\"\n },\n \"title\": \"<string>\",\n \"body\": \"<string>\",\n \"image_url\": \"<string>\",\n \"landing_url\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clix.so/api/v1/messages:send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Clix-Project-ID"] = '<api-key>'
request["X-Clix-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"push_notifications\": [\n {\n \"target\": {\n \"project_user_id\": \"<string>\"\n },\n \"title\": \"<string>\",\n \"body\": \"<string>\",\n \"image_url\": \"<string>\",\n \"landing_url\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"delivery_results": [
{
"message_id": "<string>",
"additional_params": {
"device_id": "<string>",
"fcm_message_id": "<string>",
"failure_reason": "<string>"
}
}
]
}"Invalid push notification parameters"Error Responses
400 Bad Request
Returned when the request contains invalid push notification parameters. Returns a plain text error message:Invalid push notification parameters
401 Unauthorized
Authentication failed or invalid API key.Authorizations
Project ID for authentication
API Key for authentication
Body
application/json
Request body containing the push notifications to send.
Request schema for sending push notifications.
List of push notifications to send. (We recommend sending up to 500 push notifications.)
Show child attributes
Show child attributes
Response
A successful response containing the delivery results for each push notification.
Response schema containing the delivery results for each push notification.
List of delivery results for each push notification.
Show child attributes
Show child attributes
Was this page helpful?
⌘I