kffl / nextcloud-webhooks Goto Github PK
View Code? Open in Web Editor NEWWebhooks app for Nextcloud :globe_with_meridians: :zap:
Home Page: https://apps.nextcloud.com/apps/webhooks
License: GNU Affero General Public License v3.0
Webhooks app for Nextcloud :globe_with_meridians: :zap:
Home Page: https://apps.nextcloud.com/apps/webhooks
License: GNU Affero General Public License v3.0
Hi all,
as soon as I activate the app my log gets flooded (several entrys per minute) with following error messages:
[PHP] Fehler: Error: Undefined index: scheme at /var/www/nextcloud/apps/webhooks/lib/Listeners/AbstractListener.php#55 at <<closure>>
0. /var/www/nextcloud/apps/webhooks/lib/Listeners/AbstractListener.php line 55
OC\Log\ErrorHandler::onError()
1. /var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php line 87
OCA\Webhooks\Listeners\AbstractListener->handle()
2. /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 251
OC\EventDispatcher\ServiceEventListener->__invoke()
3. /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 73
Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
4. /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php line 88
Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
5. /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php line 100
OC\EventDispatcher\EventDispatcher->dispatch()
6. /var/www/nextcloud/apps/user_status/lib/Controller/HeartbeatController.php line 91
OC\EventDispatcher\EventDispatcher->dispatchTyped()
7. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 225
OCA\UserStatus\Controller\HeartbeatController->heartbeat()
8. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 133
OC\AppFramework\Http\Dispatcher->executeController()
9. /var/www/nextcloud/lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch()
10. /var/www/nextcloud/lib/private/Route/Router.php line 298
OC\AppFramework\App::main()
11. /var/www/nextcloud/ocs/v1.php line 63
OC\Route\Router->match()
12. /var/www/nextcloud/ocs/v2.php line 23
require_once("/var/www/nextcloud/ocs/v1.php")
PUT /nextcloud/ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json
from [removed_ip_adress] by [user] at 2022-11-27T11:17:45+00:00
The setting looks (as far as I can see ok:
The Webhooks app is enabled
The secret used for signing POST requests is defined
The curl command appears to be working
Active Events with corresponding Webhook URLs:
Calendar Object Created: http://127.0.0.1:5000/my_webhook
and requests are send correctly when a new Calendar item is created
Thanks,
Marc
The "File created" event already has the file path inside of its metadata, so it should be pretty simple, to expose the file path to the filter options dropdown, right?
Would be a much appreciated feature, so I don't have to do this on the receiver side of the webhook.
This would allow me to use my discord bot to listen for those messages and automatically DM (or mention) the user that they have reached their quota. this also allows for more granular tracking of this event within discord.
Hi,
NC 26 has been released.
Just tested Webhooks on it and it seems to work flawlessly.
Could you please update the max version ?
Thanks :)
Nextcloud 25 is being released on 10/18 as stable. I haven't personally tested webhooks with it yet in rc, so just an fyi.
Hi, i am trying to use your app with discord webhook, but it doesnt work, i activated user login in config.php along with my discord webhook's url but nothing happen, is discord supported ?
Thanks
Hi,
first of all, thanks for the nice app and especially for the integration into the flow system!
I have a feature request:
At the moment, you have to manually edit the config php file to set up event based notifications and the webhooks_secret
parameter.
Since I use a hosted-Nextcloud instance where I have full admin access to Nextcloud but no access to the file system (and thus also not to config.php
, I cannot set this parameters.
Do you think it is possible and makes sense to make this configurable in the webinterface as well?
For flow based notifications, an alternative could be to define a secret alongside the flow, so one could even use different secrets for different notification targets.
Is it possible to add tracking for an upcoming calendar event. This would be a much needed feature for reminders of events on third party platforms.
Hi there
Creating and updating works perfectly with Zapier, but if I delete a calendar entry, the change does not arrive at Zapier. Would it also be possible to trigger an event when a calendar item is deleted?
Greetings
Currently, the X-Nextcloud-Webhooks
authentication header is calculated by concatenating the payload/body with a shared-secret, and computing the SHA2 hash of this data:
Once the secret is defined, all outgoing webhook notifications will contain a signature in the
X-Nextcloud-Webhooks
HTTP header. The signature is calculated by performing a SHA256 function on the POST request raw body concatenated with the secret defined earlier.
I propose to instead (or in addition) use a proper HMAC for this.
Why? Wikipedia to the rescue: HMAC → Design principles
The design of the HMAC specification was motivated by the existence of attacks on more trivial mechanisms for combining a key with a hash function. For example, one might assume the same security that HMAC provides could be achieved with MAC = H(key ∥ message). However, this method suffers from a serious flaw: with most hash functions, it is easy to append data to the message without knowing the key and obtain another valid MAC ("length-extension attack"). The alternative, appending the key using MAC = H(message ∥ key), suffers from the problem that an attacker who can find a collision in the (unkeyed) hash function has a collision in the MAC (as two messages m1 and m2 yielding the same hash will provide the same start condition to the hash function before the appended key is hashed, hence the final hash will be the same). Using MAC = H(key ∥ message ∥ key) is better, but various security papers have suggested vulnerabilities with this approach, even when two different keys are used
Another reason is that a standardized HMAC is easier to use an more safe than a custom-build authentication mechanism.
I am not a PHP-expert, but for example there is hash_hmac
.
But I think it is a better idea to use a more standardized approach like a HMAC-JSON Web Token (with algorithm HS256
and the payload emitted in the token), which has great library support.
I assume that just changing how the value of X-Nextcloud-Webhooks
is computed will break the setup of users who compute the header in the way you currently do. An alternative approach would be to add a second header in addition to the existing one that contains the HMAC, so users can chose which header they want to verify.
Just an idea. :-)
Is it possible to trigger a webhook when using the entire directory with files inside?
Hey
This looks awesome! However, if it would also support webhooks for Deck events, that would be even better. It would i.e. allow for automated notifications when cards are moved to a channel somewhere, something that is lacking currently. Has this feature been thought about?
Thank you for creating this app!
The functionality this app provides is an often sought for request for existing apps. Allowing users to setup custom webhooks with nextcloud flow would allow seamless integration of this app with a lot of apps.
Hello kffl
I don't quite understand the "Authenticating requests" function. If I define a webhooks_secret, I should be able to open the POST at the target URL only if I authenticate with my webhooks_secret. But I can receive and read the POST on the target URL without authentication.
Maybe I understand something wrong?
Thanks for your help.
Greetings
swelcom
When do you propose Nextcloud 24 compatibility will be available?
Given rather unusual nature of this app (core functionality revolving around notifying an external system via HTTP POST requests), it seems that the most reasonable way to automate testing would rely on e2e approach. A draft solution would be to create a separate Node.js server used as a webhook target (performing assertions on received data) with events triggered by simulated frontend user activity automated via Cypress. Such pipeline would allow for quicker delivery of updates for newer Nextcloud versions, as they wouldn't have to be tested manually.
I've got Internal Server Error after go to: Administration->Security if Webhooks app has been enabled.
from log:
{"reqId":"ZA91ZOerowcy0SOwTQfH@AAAAW","level":3,"time":"2023-03-13T19:11:32+00:00","remoteAddr":"89.00.00.000","user":"admin","app":"index","method":"GET","url":"/index.php/settings/admin/security","message":"Call to undefined function OCA\Webhooks\Settings\exec() in file '/home/tsr/domains/cpdm.pl/public_html/chmura/apps/webhooks/lib/Settings/Admin.php' line 81","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"25.0.4.1","exception":{"Exception":"Exception","Message":"Call to undefined function OCA\Webhooks\Settings\exec() in file '/home/tsr/domains/cpdm.pl/public_html/chmura/apps/webhooks/lib/Settings/Admin.php' line 81","Code":0,"Trace":[{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[["OCA\Settings\Controller\AdminSettingsController"],"index"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Settings\Controller\AdminSettingsController","index",["OC\AppFramework\DependencyInjection\DIContainer"],["security","settings.AdminSettings.index"]]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/base.php","line":1047,"function":"match","class":"OC\Route\Router","type":"->","args":["/settings/admin/security"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/private/AppFramework/Http/Dispatcher.php","Line":165,"Previous":{"Exception":"Error","Message":"Call to undefined function OCA\Webhooks\Settings\exec()","Code":0,"Trace":[{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/apps/webhooks/lib/Settings/Admin.php","line":62,"function":"testCurl","class":"OCA\Webhooks\Settings\Admin","type":"::","args":[]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/apps/settings/lib/Controller/CommonSettingsTrait.php","line":129,"function":"getForm","class":"OCA\Webhooks\Settings\Admin","type":"->","args":[]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/apps/settings/lib/Controller/AdminSettingsController.php","line":83,"function":"formatSettings","class":"OCA\Settings\Controller\AdminSettingsController","type":"->","args":[[[["OCA\Settings\Settings\Admin\Security"]],[["OCA\Password_Policy\Settings"]],[["OCA\OAuth2\Settings\Admin"]],[["OCA\Webhooks\Settings\Admin"]]]]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/apps/settings/lib/Controller/CommonSettingsTrait.php","line":149,"function":"getSettings","class":"OCA\Settings\Controller\AdminSettingsController","type":"->","args":["security"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/apps/settings/lib/Controller/AdminSettingsController.php","line":68,"function":"getIndexResponse","class":"OCA\Settings\Controller\AdminSettingsController","type":"->","args":["admin","security"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"index","class":"OCA\Settings\Controller\AdminSettingsController","type":"->","args":["security"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[["OCA\Settings\Controller\AdminSettingsController"],"index"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[["OCA\Settings\Controller\AdminSettingsController"],"index"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Settings\Controller\AdminSettingsController","index",["OC\AppFramework\DependencyInjection\DIContainer"],["security","settings.AdminSettings.index"]]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/lib/base.php","line":1047,"function":"match","class":"OC\Route\Router","type":"->","args":["/settings/admin/security"]},{"file":"/home/tsr/domains/cpdm.pl/public_html/chmura/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/home/tsr/domains/cpdm.pl/public_html/chmura/apps/webhooks/lib/Settings/Admin.php","Line":81},"CustomMessage":"--"}}
Hello,,
is it possible to define Nextcloud updates and app updates as a webhook event? I regularly receive emails when new app or Nextcloud updates are available. Instead of emails, I would like to be able to trigger webhooks so that the monitoring system can react accordingly.
Just want to send encouragement for adding your excellent webhooks app to the appstore. Here is documentation info. Thanks either way.
Hi,
is it possible to integrate the old name of a file into the json object if a file has been renamed? At the moment only the new name is transmitted.
greetings,
Christian
Is it possible to attach a file to the external webhook call?
I want to create a webhook for "new pdf-files" in a given directory. If a new file is saved into this directory, it should be send to an external API (with attached file).
Looking forward for your suggestions how to archive this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.