Listen for Notifications
You can have your Plex server push notifications to a client through a Websocket connection.
This API endpoint will allow you to establish a live connection to your server and have your server stream notifications.
This endpoint can be used to stream the log notifications from your Plex server to another application.
URL
wss://{ip_address}:32400/:/websockets/notifications?filters={filters}&X-Plex-Token={plex_token}Parameters
| Name | Description |
|---|---|
| ip_address | The IP address of the Plex Media server. |
| plex_token | The Plex token. |
| filters | The type of notification filter to apply. The available filter options are outlined in the Filters section. |
Return Status
| HTTP Code | Description |
|---|---|
| 200 | Success - The request was successful. |
| 401 | Unauthorized - The Plex token provided was not valid. |
Response
When a connection is established, a JSON response with the following information is returned from a Plex server when a notification occurs:
{"NotificationContainer":{"type":"log","size":1,"LogSentNotification":[{"level":3,"thread":"6536","time":"Nov 29, 2024 11:00:09.977","message":"Beginning read from WebSocket"}]}}
For each notification sent from the server, the following fields are included:
| Name | Description |
|---|---|
| type | The type of notification. |
| size | The number of notifications included. |
| LogSentNotification | An array of data regarding the log notification. |
An array of LogSentNotification information can be sent from the Plex server. Information in the array includes the following:
| Name | Description |
|---|---|
| level | The notification logging level. |
| thread | The thread. |
| time | The date and timestamp of the notification. |
| message | The message of the notification. |
Remarks
Filters
To return specific events, you can apply filters to the API command. If a filter parameter is not passed into the command, then all events will be pushed to the client.
The following table lists valid filters that can be passed into the command.
| Name | Description |
|---|---|
| log | Notification from the Plex log. |
Script examples
Below are a list of post and articles that provide an example that use this API endpoint: