No description
Find a file
Joas Schilling 4910001ebe
Remove command class
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-03-01 12:47:56 +01:00
.github Promote the issue template app 2017-04-05 09:31:30 +02:00
.tx Provide l10n for admin_notifications app 2018-02-13 19:58:07 +01:00
appinfo This app is obsoleted with Notifications app for Nextcloud 14 2018-02-16 13:39:30 +01:00
docs Add sample calls to the README 2017-02-09 11:30:24 +01:00
img Allow to create notifications via occ 2017-02-09 10:35:43 +01:00
l10n Provide l10n for admin_notifications app 2018-02-13 19:58:07 +01:00
lib/AppInfo Remove command class 2018-03-01 12:47:56 +01:00
tests This app is obsoleted with Notifications app for Nextcloud 14 2018-02-16 13:39:30 +01:00
.gitignore Init empty repo 2017-02-09 10:35:17 +01:00
.travis.yml No more 5.6 2018-02-16 13:46:11 +01:00
COPYING Init empty repo 2017-02-09 10:35:17 +01:00
Makefile Fix Makefile 2018-02-27 14:03:27 +01:00
README.md Update README.md 2018-02-20 11:21:44 +01:00

⚠️ App "admin_notifications" is obsoleted with Nextcloud 14 ⚠️

The functionality of the "admin_notifications" app has been merged into the default notifications app for Nextcloud 14. You can savely uninstall and delete the "admin_notifications" app, because it does not do anything anymore.

The new documentation is in the notifications repository.

🔧🔔 Admin notifications

Allows admins to generate notifications for users via the console or an HTTP endpoint

Console command

$ sudo -u www-data ./occ notification:generate \
  admin "Short message up to 255 characters" \
  -l "Optional: longer message with more details, up to 4000 characters"

Help

$ sudo -u www-data ./occ notification:generate --help
Usage:
  notification:generate [options] [--] <user-id> <short-message>

Arguments:
  user-id                          User ID of the user to notify
  short-message                    Short message to be sent to the user (max. 255 characters)

Options:
  -l, --long-message=LONG-MESSAGE  Long mesage to be sent to the user (max. 4000 characters) [default: ""]

HTTP request

curl -H "OCS-APIREQUEST: true" -X POST \
  https://admin:admin@localhost/ocs/v2.php/apps/admin_notifications/api/v1/notifications/admin \
  -d "shortMessage=Short message up to 255 characters" \
  -d "longMessage=Optional: longer message with more details, up to 4000 characters"

Help

curl -H "OCS-APIREQUEST: true" -X POST \
  https://<admin-user>:<admin-app-password-token>@<server-url>/ocs/v2.php/apps/admin_notifications/api/v1/notifications/<user-id> \
  -d "shortMessage=<short-message>" \
  -d "longMessage=<long-message>"

admin-user:                User ID of a user with admin priviliges
admin-app-password-token:  Password or an "app password" of the "admin-user"
server-url:                URL with Webroot of your Nextcloud installation
user-id:                   User ID of the user to notify
short-message:             Short message to be sent to the user (max. 255 characters)
long-message:              Long mesage to be sent to the user (max. 4000 characters)

Return codes

Status Description
200 Notification was created successfully
400 Too long or empty short-message, too long long-message
404 Unknown user
500 Unexpected server error
503 Instance is in maintenance mode

Screenshot

Both the occ command and the HTTP request generate the same notification

Admin notification triggered from console