Send Message to Clients from Server

The ability to send an on-screen message to clients from server by admin, letting clients know an event will take place such as server updates, or restarts.

I like it.

"Hey kids. Come on down for dinner!"

You can already do this with:

POST /api/notify

(Scroll to the bottom to see the format of the payload)

I had to add --header "Content-Type: application/json" to the cURL command to get it to work. Message/Notification displays for about 5 seconds before disappearing on its own.

Just added this capability to OliveTin-for-Channels. Message will be sent to a group of clients as defined in an environment variable. Since the message disappears after 5 seconds, it'll send successive messages up to 60 seconds worth:

There's an undocumented extra parameter in the JSON called timeout that is the number of seconds you'd like the notification to be displayed for.

1 Like

Thanks for the tip. I've modified the OliveTin-for-Channels Action Button accordingly!

timeout may just be on the Apple TV client though, hence it being undocumented.

Ouch! Turns out that's correct. Reverting...

Added the timeout parameter to Android too.

My intention was to have a textbox on the "Clients" screen with selectable icon and to simply send the message from there. Maybe even a setting for the delay.

There's no plans to add anything like that. But feel free to use the Channels API, which can do it.

1 Like

Tried Powershell, but no joy. I'm sure my syntax is incorrect.

curl -Method POST -Uri 'http://mynas:8089/api/notify' -d '["title": "Notice", "message": "Updating Server in 5 mins.", "icon" "fa:door"]'

Did you not see the previous post about needing a Content-Type header?

1 Like

Add OliveTin and you'll have a super-charged version of what you've asked for, plus:

  • Comskip on/off by channel
  • List channels with Comskip off
  • Manually add recordings
  • Find Gracenote station IDs
  • Fix YouTube thumbnails
  • Download TwiT.tv guide data
  • Generate channels list in CSV format
  • Generate movie list in CSV format
  • Scan/Prune local content
  • Mark an episode for re-recording
  • Channel lineup change notifications
  • Generate filtered Channels DVR log
  • List sources for a single channel
  • Delete Channels DVR recording log files
  • Send message to defined Channels clients

There will always be scripts & tricks that will not be part of the mainstream Channels DVR release -- this project is a catch-all for just these kinds of things.

I did, and when used error in curl stating it could not convert the header. Give me a little credit at least....

Thanks, I'll give it a look.

Here is what I started out with in Powershell and the result. The syntax differs from php cli.

PS C:\WINDOWS\system32> curl -Method POST -Uri http://mynas:8089/api/notify -header "Content-Type: application/json" -d '{"title": "Notice", "message": "Rebooting Server in 5 mins.", "icon": "fa:door"}'

Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the "Content-Type: application/json" value of type
"System.String" to type "System.Collections.IDictionary".
At line:1 char:67
+ ... ynas:8089/api/notify -header "Content-Type: application/json" -d '{"t ...
+                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Did you try Windows commandline

curl -XPOST http://mynas:8089/api/notify -header "Content-Type: application/json" -d '{"title": "Notice", "message": "Rebooting Server in 5 mins.", "icon": "fa:door"}'