Skip to content

Public Notification

Sends a notification to all users in Liner.

Note

A notification with the urgent type is automatically opened for the user in Liner if they are online.


Endpoint and Method

POST /v1/notification/public/


Parameters (Body)

title string
Notification title (string).

text string
Notification text (string).

type enum
Notification type. Possible values: default, urgent (urgent opens automatically).

level enum
Notification level/style. Possible values: default, success, warning, danger.


Request Example

curl -X POST "https://YOUR_LINER_API_HOST/v1/notification/public/" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_TOKEN" \
  -d '{
    "title": "{{title}}",
    "text": "{{text}}",
    "type": "{{notification_type}}",
    "level": "{{notification_level}}"
  }'
<?php

$host = 'https://YOUR_LINER_API_HOST';
$token = 'YOUR_API_TOKEN';

$payload = [
    'title' => $title,
    'text' => $text,
    'type' => $notification_type,   // default | urgent
    'level' => $notification_level, // default | success | warning | danger
];

$ch = curl_init($host . '/v1/notification/public/');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'X-Api-Key: ' . $token,
    ],
    CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
    CURLOPT_TIMEOUT => 15,
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($response === false) {
    throw new RuntimeException('cURL error: ' . curl_error($ch));
}

curl_close($ch);

echo "HTTP {$httpCode}\n";
echo $response;
const host = "https://YOUR_LINER_API_HOST";
const token = "YOUR_API_TOKEN";

const payload = {
  title: title,
  text: text,
  type: notification_type,   // default | urgent
  level: notification_level  // default | success | warning | danger
};

const res = await fetch(`${host}/v1/notification/public/`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": token
  },
  body: JSON.stringify(payload)
});

const data = await res.json();
console.log("HTTP", res.status, data);

Response Example

{
  "success": true,
  "message": "",
  "data": []
}