matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

Allow system admins to send server notices to all local users #5501

Open rxl881 opened 5 years ago

rxl881 commented 5 years ago

(It seems that there have been previous issues to track this, but all appeared to be closed at the moment)

Admin APIs exist to send server notices to users - https://github.com/matrix-org/synapse/blob/master/docs/admin_api/server_notices.md (, and https://github.com/matrix-org/synapse/blob/master/docs/server_notices.md for more generic info. on server notices and their expected use). However, at present it only allows for messages to be sent to specific users.

It would be very useful to be able to send messages to all local users (e.g. for "Messages of the day" or policy updates etc.).

Can we please open up the existing API to send to all users matching a pattern (including '.*'), or create a new endpoint to allow for this?

richvdh commented 5 years ago

be aware that such an implementation for "motd" would mean: (a) users that register after the server_notice spam wouldn't receive the motd; (b) users that don't log in between server_notice spams would get all the notices at once when they do log in, which might be a bit confusing.

rxl881 commented 5 years ago

a) Isn't an issue from my POV (as I would expect it to work). b) Noted, but similarly to a), this is probably a feature - "these are the important, system-wide, things that happened since you last logged in". Hopefully they will be very rare, and can be easily marked as read / discarded as it's just one room.

nicfab commented 3 years ago

It would be an excellent opportunity for the server admin to send messages to all the local users.

ptman commented 3 years ago

Does it really need to be an API? https://github.com/Awesome-Technologies/synapse-admin/ can be used to send notices to multiple recipients at once.

nicfab commented 3 years ago

Does it really need to be an API? https://github.com/Awesome-Technologies/synapse-admin/ can be used to send notices to multiple recipients at once.

Great! Thank you. After the installation, I should set an Nginx reverse proxy to point http://localhost:8080 to a different address. Is it so?

BBaoVanC commented 3 years ago

Does it really need to be an API? https://github.com/Awesome-Technologies/synapse-admin/ can be used to send notices to multiple recipients at once.

then you run into Awesome-Technologies/synapse-admin#90

dklimpel commented 3 years ago

It would be an excellent opportunity for the server admin to send messages to all the local users.

This API have to be async because send messages to all users of a server can take a while.

Justinzobel commented 2 years ago

This would be great, right now I am using a python3 script I found to message all users but it has to run at the rate limit. A tool to message all users without having to wait would be much better.

ptman commented 2 years ago

https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#override-ratelimiting-for-users

blinton-sp commented 2 years ago

Would also love for the ability to do this. Perhaps allowing for a "*" in the json content passed to the POST /_synapse/admin/v1/send_server_notice call

a-0-dev commented 1 year ago

I would also welcome this feature, but as it wasn't there I implemented this functionality for synadm last summer: https://github.com/JOJ0/synadm/pull/74

So if someone of you is using synadm (a very nice wrapper of the admin API), just use this module for sending notices :)

Justinzobel commented 1 year ago

It would be amazing if Synadm could be merged into the Synapse system or at least hosted within the matrix-org organisation on GitHub.

gabrc52 commented 1 year ago

I agree. A use case for this is on the off change that some maintenance is needed and you wish to notify users about downtime.

rltas commented 1 year ago

https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#override-ratelimiting-for-users

This doesn't seem to work, I assume because system_mxid_localpart isn't a "real" user.

gabrc52 commented 1 year ago

No, but you can disable rate limiting for yourself / the admin account to use it to call the admin API repeatedly for everyone

rltas commented 1 year ago

While that totally makes sense (and I feel like I shouldn't have missed that 😛), I actually have both in ratelimit_override and I'm still running into the rate limit.

          user_id           | messages_per_second | burst_count
----------------------------+---------------------+-------------
 @root:mymatrixdomain.net   |                   0 |           0
 @system:mymatrixdomain.net |                   0 |           0

{"errcode":"M_LIMIT_EXCEEDED","error":"Too Many Requests","retry_after_ms":2150}

And I restarted Synapse, just to be sure.

gabrc52 commented 1 year ago

It might be because of this https://github.com/matrix-org/synapse/issues/11785

rltas commented 1 year ago

Also see #15974