caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
10.9k stars 384 forks source link

Nextcloud group support #1111

Open ostasevych opened 2 months ago

ostasevych commented 2 months ago

Hi! Is that possible to make Nextcloud notifications be extended to groups of users? So, I can send notifications to groups. Plus, to add the possibility to send the notification to all active users (eg everyone)?

ostasevych commented 2 months ago

Taking into account that NC cannot list users of a specific group, I suggest this workaround to send text message to a specific group:

php ./occ group:list | \
sed -En '/^[[:space:]]*-[[:space:]]<groupname>.$/,/^[[:space:]]{2}-[[:space:]][^-]/{/^[[:space:]]*-[[:space:]]/{s/^[[:space:]]{4}-[[:space:]]//p}; /^[[:space:]]*-[[:space:]]/d}' | \
xargs -i php ./occ notification:generate -l "Body of the message" {} "Header of the message"

Perhaps you may update existing Nextcloud notifications provider or create a new eg Nextcloud group notifications provider?

And this one for sending to ALL users:

php ./occ user:list | sed 's/.*- \(.*\):.*/\1/' | \
xargs -l -i php ./occ notification:generate -l "Body of the message" {} "Header of the message"

Inspired by https://github.com/nextcloud/notifications/issues/121 and long-time training ChatGPT :)