Sending messages
As already mentioned in the Introduction, you need a channel to send messages to Notifly. Only the user who created a channel can see its messages. You can add a channel via
- WebUI: open the «Channels» section in the sidebar and click «Create channel»
- REST API:
curl -u admin:admin https://yourdomain.com/application -F "name=test" -F "description=tutorial"(theapplicationURL is kept for compatibility with the Gotify protocol). See the API documentation
To send messages to a channel you need the app token for that channel. The token is returned in the REST response and visible in the WebUI.
Now you can just use curl, HTTPie or any other HTTP client to send messages.
$ curl "https://push.example.de/message?token=<apptoken>" -F "title=my title" -F "message=my message" -F "priority=5"$ http -f POST "https://push.example.de/message?token=<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://push.example.de/message?token=<apptoken>" -Method POST -Body @{title="my title"; message="my message"; priority=5} # result is automatically parsed into a PowerShell objectPS> Invoke-WebRequest -Uri "https://push.example.de/message?token=<apptoken>" -Method POST -Body @{title="my title"; message="my message"; priority=5} # result as a raw responseThe message API accepts the property
extras, which transmits additional information with the message and describes how clients should behave regarding this message. See additional message fields for more information.
Starting with Notifly v1.2.0 only the message parameter is required.
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 webhooks — token in the URL, no headers and no CORS preflight.
You can also use the [Notifly CLI](https://github.com/Notifly CLI) to send messages. The CLI stores the URL and token in a configuration file.
$ notifly push -t "my title" -p 10 "my message"$ echo my message | notifly push[How to install Notifly CLI](https://github.com/Notifly CLI).