i read a little about the open collaboration service (OCS) API but i’m not sure if i understand i right or not.
i’m interested in notifications. Is there a way to send (push) notifications to a user or group via this API? I would like to use my nextcloud as a push-Server for other Services (like Home automation).
With OCC it is possible with
php occ notification:generate username "This is a message"
Actually i want to call this from another system (another docker-Container).
Can someone help me doing this?
okay i figured it out myself.
it can be done with “admin notification” app and OCS API.
curl -H "OCS-APIREQUEST: true" -u <admin>:<admin-PW> -X POST <https://<my-cloud-address.de>/ocs/v2.php/apps/admin_notifications/api/v1/notifications/<user-to-send-message-to> -d "shortMessage=<message>"
Do you know the OCS requet to sent a push notification for the Android/IOS app?
It is the curl-request in my former post.
This sends message to the specified user. In my case I get notifications on Android, ios and even Windows if client app has permissions.
I lost something in the process because I could create the notification using curl-request but I didn’t get any ‘popup’ on Android…
in version Nextcloud 22.1.X, the following worked for me:
curl -H "OCS-APIREQUEST: true" -X POST \
-d shortMessage="Short Message" \
-d longMessage="This is the long message"
Thanks alot for sharing this.
I changed my implementation to this and works perfectly.
Hello, Can someone explain how this solution actually works? I installed the admin notification but cannot find any settings. Where will i insert the OCS API?
The OCS API is shipped with Nextcloud server but it is not meant to be used on user level (web interface).
If you want to use the notifications you have to ssh into your Nextcloud host (a Linux machine, raspberry Pi, whatever) and type the curl request into the shell.
Ok but i don’t get push notification. Also this doesn’t solve the notifications of talk and calendar apps. The platform is useless without real-time notifications
Notifications from calendar and other build-in features should work out of the box. It’s working for me in the last 3 years without my OCS hacks.
So if you don’t get notifications at all, I suggest to open a new Thread or GitHub issue and discuss with admins.
To be honest, I also had some missing notifications in the last days after trying Nextcloud talk. After removing Talk app and reconnecting the Nextcloud files app on my iPhone, it’s working fine.
I‘m using the OCS API to utilize Nextcloud for my home automation system and send HA notifications through Nextcloud App.
To your last sentence: Nextcloud is open source. If it doesn’t meet your needs and expectations, feel free to contribute.