Simple python app to listen for Plex Webhooks and relay events to slack channnel
This is super rough first draft. I'm using the project to better understand API's, Webhooks, python, and everything in between. The current listener is probably best just for testing environments.
Future aspirations is to use AWS API Gateway and a AWS lambda for notifications
If you are looking for something more refined check Plex's example app here
Events Currently Supported:
- media.play
- media.scrobble
- Create a Slack Incoming Webhook and copy url to Environment Variable
SLACK_URL
or create config file at~/.plex_notify_config.json
- Add Plex Webhook to IP running the app see here for instructions
- Clone the repo
- Install python requirements
pip install -r requirements.txt
should only needflask
andrequests
- From the repo directory Start listener:
python3 listener.py
- Start watching and look for a message
{
"slack_url": "URL HERE"
}
- Edit
plex-notify.service
Change [USER] to the user to run the app, [PATH TO PYTHON] and [PATH TO/listener.py] see example below - Copy
plex-notify.service
to systemd folder:cp plex-notify /etc/systemd/system
- Enable and start service:
systemctl enable plex-notify.service && systemctl start plex-notify.service
Example systemd config file:
[Unit]
Description=Plex Notify
After=network.target
[Service]
User=someuser
Restart=always
RestartSec=5
Type=simple
ExecStart=/usr/bin/python3 /opt/plex-notify/listener.py
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
- Add more events
- Listener: Handle image attachments for the webhooks that have them
- Make a listener that isn't using the dev webserver
- Pretty the notifications (ie add image, etc)
- Make python2.7 backwards compatible (future use with aws lambda)
- Fix all the things =)