kratos icon indicating copy to clipboard operation
kratos copied to clipboard

Jsonnet flag to skip triggering of web hook

Open renom opened this issue 1 year ago • 2 comments

Preflight checklist

Ory Network Project

No response

Describe your problem

Our project needs to run a web hook for a specific identity schema only.

Describe your ideal solution

Setting a specific key in jsonnet to skip triggering of the web hook, for example:

function(ctx) {
  ory.sh/kratos/skip: ctx.identity.schema_id != "specific_schema_id",
}

Then the web hook will be skipped if schema_id isn't "specific_schema_id".

Workarounds or alternatives

Alternative solution would be adding a list of allowed schemas to web hook config:

  - hook: web_hook
    config:
      url: <web_hook_url>
      method: POST
      body: request-data.jsonnet
+     allowed_schemas: ["schema_id_1", "schema_id_2", ...]

Version

1.3.0

Additional Context

No response

renom avatar Sep 30 '24 12:09 renom

Sorry, it seems "interrupting" is a wrong word to describe what I meant here. It should be more like skipping of triggering web hook remote url, without actual interrupting of flow. E.g. a remote url is triggered only for specific schemas, while for the others a web hook will be just skipped without an error or interrupting of the flow. I'll update the description of the issue.

renom avatar Sep 30 '24 12:09 renom

Done.

renom avatar Sep 30 '24 12:09 renom

You can work around this by returning 204 from your webhook endpoint.

alnr avatar Nov 27 '24 11:11 alnr

You can also return a cancel error (it’s in the docs) to cancel webhook exectuion.

aeneasr avatar Feb 13 '25 16:02 aeneasr