Skip to content

Sending messages

As already mentioned in the Introduction, you need a channel to send messages to Notifly. Only the user who created the channel can see its messages. You can add a channel via

  • WebUI: open the “Channels” section in the sidebar and click “Create channel” in the admin at app.notifly.ru
  • REST API: curl -u admin:admin https://notifly.ru/application -F "name=test" -F "description=tutorial" (the application path is kept for compatibility with the Gotify protocol). See the API documentation

To send messages to a channel you need that channel’s app token (prefix A). The token is returned in the REST response and visible in the WebUI.

Now you can simply use curl, HTTPie or any other HTTP client you have installed to send messages. The app token is passed either in the X-Notifly-Key header or as the token parameter in the URL.

Окно терминала
$ curl https://notifly.ru/message -H "X-Notifly-Key: <apptoken>" -F "title=my title" -F "message=my message" -F "priority=5"
$ http -f POST https://notifly.ru/message X-Notifly-Key:"<apptoken>" title="my title" message="my message" priority="5"

In Microsoft PowerShell you can use the built-in cmdlets Invoke-RestMethod or Invoke-WebRequest.

Окно терминала
PS> Invoke-RestMethod -Uri "https://notifly.ru/message" -Method POST -Headers @{"X-Notifly-Key"="<apptoken>"} -Body @{title="my title"; message="my message"; priority=5} # the result is automatically parsed into a PowerShell object
PS> Invoke-WebRequest -Uri "https://notifly.ru/message" -Method POST -Headers @{"X-Notifly-Key"="<apptoken>"} -Body @{title="my title"; message="my message"; priority=5} # the result as a raw response

The message API accepts an extras property that conveys additional information with the message and describes how clients should behave regarding this message. See message extras for more information.

Only the message parameter is required. Other fields (title, priority, extras) are optional. If priority is not set, the channel’s default priority is used.

Not just one-way messages: besides regular push notifications you can send interactive questions with answer options and receive a reply back. See interactive questions.

Here are many more examples of sending messages in various languages.

Tip: for integrations from the browser, frontend and simple scripts it’s more convenient to use the form with the token parameter in the URL — no headers and no CORS preflight.

You can also use the Notifly CLI to send messages. The CLI saves the URL and token in the configuration file.

Окно терминала
$ notifly push -t "my title" -p 10 "my message"
$ echo my message | notifly push

How to install the Notifly CLI.

Метод и путьНазначениеАутентификация
POST /messageОтправить сообщение в каналApp-токен (X-Notifly-Key или ?token=)
POST /applicationСоздать каналClient-токен / Basic Auth
GET /applicationСписок каналовClient-токен / Basic Auth

Поля запроса POST /message: message (обязательно), title, priority (если не задан — defaultPriority канала), extras (см. дополнительные поля сообщения).