Перейти к файлу
Arthur Schiwon 1222de0487
adept tests to 20 branchoff
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-10-23 16:42:00 +02:00
appinfo enables webhooks settings to modify instance profiles 2020-10-23 16:27:03 +02:00
img better appicon 2020-08-20 12:58:25 +02:00
lib enables webhooks settings to modify instance profiles 2020-10-23 16:27:03 +02:00
src enables webhooks settings to modify instance profiles 2020-10-23 16:27:03 +02:00
templates settings ui for webhook profiles 2020-10-23 16:27:01 +02:00
tests settings ui for webhook profiles 2020-10-23 16:27:01 +02:00
.drone.yml adept tests to 20 branchoff 2020-10-23 16:42:00 +02:00
.gitignore bump deps 2020-08-17 15:39:06 +02:00
.stylelintrc.js settings ui for webhook profiles 2020-10-23 16:27:01 +02:00
COPYING initial commit 2019-12-21 00:41:04 +01:00
Makefile add skeleton for a paramter check 2019-12-25 23:38:47 +01:00
README.md add support for profiles 2020-10-23 16:26:56 +02:00
composer.json add support for profiles 2020-10-23 16:26:56 +02:00
composer.lock add support for profiles 2020-10-23 16:26:56 +02:00
package-lock.json Implement profile updating 2020-10-23 16:27:03 +02:00
package.json Implement profile updating 2020-10-23 16:27:03 +02:00
webpack.common.js settings ui for webhook profiles 2020-10-23 16:27:01 +02:00
webpack.dev.js add skeleton for a paramter check 2019-12-25 23:38:47 +01:00
webpack.prod.js add skeleton for a paramter check 2019-12-25 23:38:47 +01:00

README.md

Flow Webhooks

Endpoints

Every user and the instance have each one unique endpoint where webhooks can be directed to. The identifying piece it ten characters long and created once when opening the Webhook settings for the first time.

The URL follows this pattern: https://my.nxtcld.srv/ocs/v2.php/apps/flow_webhooks/api/v1/hook/{ENDPOINT_ID}

Profiles

A profile matches to an incoming request and defines the presentation of it within the possible Nextcloud operations.

There are three ways to introduce a profile to your instance:

  • by app listening to the OCA\FlowWebhooks\Events\RegisterProfile event and calling it's addProfile method with an instance of OCA\FlowWebhooks\Model\Profile. This is globally available.
  • 🏗️ by an Administrator through instance's Webhooks settings
  • 🏗️ by an user through personal Webhooks settings

Profiles added by app or admin settings are valid system wide and are priorized over personally added profiles. A profile added in the personal settings is only valid for the user who created it.

When a request comes in, the webhook service matches available profile against the request. The first profile that matches is the valid one, others are discarded. The tests happen in the order of: app profiles, admin profiles, user profiles.

Criteria for matches are request headers and parameters. One criterion consists of the name of the header or parameter, and a regular expression pattern. Several requirements are de facto and-connected, i.e. everything has to match.

Further a profile consists of templates for:

  • display text in verbosity levels of 0-3
  • an URL
  • an Icon URL

Within a template identifiers within double curly brackets are replaced with data from request parameters. Example: in the text template '{{comment.user.login}} says {{ comment.body }}' there are two identifiers: comment.user.login and comment.body. If the request payload has those values set, they will be replaces accordingly, and otherwise with by (?). When extracting identifier, the app ignores single space characters between the doubled curly brackets.

Furthermore, profiles have a name property intended to be easily identifiable for users.