Jump to content

Matrix Notifications Plugin for Emby


darkside40

Recommended Posts

darkside40

thumb.png.1e3d0ad901a50abacfefb4acd510979f.png

Matrix Notifications Plugin for Emby

Based on my Telegram Notifications Plugin i build a Plugin suitable for the Matrix Messaging Protocol. the simple advantage is that you can host your own server for it which does not rely on other people. Nope it is not in the Plugin catalog, because there are only plugins by developers which are "willing to fully support it.  That means keep it up to date with server versions as well as fix any issues and respond to user help requests." Because of the closed source code of Emby and the lack of Plugin development documentation that is something i cannot ensure.

 

What it does?

It simply forwards the Messages of the Emby Notification Framework to a Matrix Room. Not more, not less. Sorry no fancy posters etc. because the Standard Notifications of Emby dont support it.  That could be hacked into, but those things can break easily on every update.

Install

  1. Install the Plugin by downloading the DLL (or build it yourself using VS2017/VS2019) and putting it into your Emby Plugin folder
  2. Restart your Emby Server
  3. Grab yourself the Element Messenger and curl (of something similier to talk with the API)
  4. Your server needs a user account on the matrix instance to use, so register on for it
  5. Start Element with your own account and create a room, deactive encryption (important), i made mine invite only.
  6. Invite your Emby Server to the room
  7. Head to the room settings you will find the internal Room ID, something like: !klblablabla:matrix.org an note it

Now it is time to start playing with curl to get Access Token of your Emby user and join the room Mind changing the TLD etc accoring to your needs.

  1. Start with getting your Access Token curl -XPOST -d '{"type":"m.login.password", "user":"EMBYSERVERUSER", "password":"EMBYSERVERPASSWORD"}' "https://matrix.org/_matrix/client/r0/login"

  2. Join the room (the ! in the room ID must be exchanged with ah %21) curl -XPOST -d '{}' "https://matrix.org/_matrix/client/r0/rooms/%21klblablabla:matrix.org/join?access_token=ACCESSTOKEN"

  3. Test the connection curl -XPOST -d '{"msgtype":"m.text", "body":"hello"}' "https://matrix.org/_matrix/client/r0/rooms/%21klblablabla:matrix.org/send/m.room.message?access_token=ACCESSTOKEN"

  4. Go to the Plugin settings page and fill in the Access Token, Room ID (like you copied it from Element aka with the ! at front), and the Server TLD (dont forget the / at the back)

  5. Send a Test Notification

  6. Activate the Matrix Notifications Plugin in the desired Server notifications

Known Issues?

It does not support E-2-EE because there is no SDK for it. Of course TLS will be used.

 

Where to get it?

You can download the Source and DLL on Github or attached to this thread.

https://github.com/bjoerns1983/Emby.Plugin.MatrixNotification/releases

Have fun with it. If you have a cool idea simply open a Github Issue.

Would be cool to have this registration process handled on the settings page, but thats beyond my Scope. PR welcome!

 

Emby.Plugin.MatrixNotification.dll

  • Like 3
Link to comment
Share on other sites

Hello, thank you for this plugin. This would be very helpful for alle the emby/matrix guys!

Just an other idea...

It would be great to have a plugin to send the notification framework to a webhook so we can use one plugin for alle the webhook-bridges in serval messengers.

Link to comment
Share on other sites

darkside40
2 hours ago, dual-o said:

Hello, thank you for this plugin. This would be very helpful for alle the emby/matrix guys!

Just an other idea...

It would be great to have a plugin to send the notification framework to a webhook so we can use one plugin for alle the webhook-bridges in serval messengers.

The idea looks quite appealing and doing that wouldnt take more than 10min based on the Matrix Plugin.

Althought there are some caveats. You know there is no Webhook standard, rfc or spec. Everybody who does Webhooks does them a bit different. Normally it is a post request with a json payload. But it already starts with the naming of the Key:Value pairs. As long as you parse it yourself eg with NodeRed that does not matter. but you simply cannot do a plugin that is compatible with every Messenger that claims to use Webhooks.

Also like i stated many time here, the Emby Notification Framework is very limited. For each scan it gives you only 10 Names or i thin 6 Names + Descriptions back. If you add 100 Movies at once you loos 90 or 94 entries. Also there are no more info, only Name (Title) and Description.

The better way would be that the Emby Dev's add a New Content Webhook, okay that would have the caveat that only paying members would have access to but the possibilities would be enormous.

If you like that idea reply to the following post to show some love to it, so it don't dissappears in the New Feature Friendzone like so many other good ideas.

Maybe we also would get an ETA for that

  • Like 1
Link to comment
Share on other sites

GWTPqZp6b
21 minutes ago, darkside40 said:

the Emby Notification Framework is very limited. For each scan it gives you only 10 Names or i thin 6 Names + Descriptions back. If you add 100 Movies at once you loos 90 or 94 entries. Also there are no more info, only Name (Title) and Description.

Thanks for sharing this, this is somewhat limiting. Are you aware of a backlog ticket that users can vote on to encourage/prioritise emby devs work to improve notifications?

EDIT: Looks like my question was answered above :) Thx

Edited by GWTPqZp6b
Link to comment
Share on other sites

darkside40
1 minute ago, GWTPqZp6b said:

Thanks for sharing this, this is somewhat limiting. Are you aware of a backlog ticket that users can vote on to encourage/prioritise emby devs work to improve notifications?

No i am not aware of something like this. Because of that i am pushing that thread for the new webhook so maybe someone hears it and sees that there is a demand for it. 
 

you could also try the Playback reporting plugin. It also has a new media notification which at least show you all Movies/Episode added since the last rum. 

Link to comment
Share on other sites

  • 10 months later...
darkside40

I will have a look at the PR i got from @Luke for the Telegram Plugin an than port it when i find time for it.

 

Edited by darkside40
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • 4 weeks later...
GWTPqZp6b

Having had a bit of time to use with this plug I've noticed I'm not getting all alerts, for example I get new media added alerts fine, but dont see alerts when media is played/updated etc. Is this likely to be related to the underlying modifications code, or the matrix plugin? Will grab some debug logs tomorrow just want to make sure I direct them appropriately. 

Link to comment
Share on other sites

darkside40

Becasue this plugin only forward what it gets from the notification framework i would say its better to ask in the support thread for it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...