freezing-planet-21392
08/08/2025, 12:08 PMbrief-egg-61061
08/08/2025, 12:08 PMbrief-egg-61061
08/08/2025, 12:08 PMctx
object) that is available to your Jsonnet template, containing information about the flow, the identity, request headers, and more. For the after
execution path of all flows (including OIDC), the following objects are available in the Jsonnet template via the ctx
object: - `flow`: Information about the current flow (e.g., registration, login). - `identity`: The identity object (user) involved in the flow. - `transient_payload`: Any additional data passed during the flow. - request_headers
, request_method
, `request_url`: Details about the HTTP request that initiated the flow. You can see a detailed example of the ctx
object and its available properties in the documentation. Here’s a sample of how you might access these fields in Jsonnet: jsonnet function(ctx) { userId: ctx.identity.id, email: ctx.identity.traits.email, flowId: ctx.flow.id, method: ctx.request_method, url: ctx.request_url }
For a full example of the ctx
object and its structure, refer to the documentation's expanded example for registration flows. This will show you exactly what data is available to your Jsonnet template and, therefore, what can be included in the webhook body. If you do not provide a custom Jsonnet template, the webhook may send a minimal or empty payload, so it is best practice to define what you need explicitly in your Jsonnet file [Customizing request body with Jsonnet](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#define-http-request). Summary: - There is no fixed default body; you define it with Jsonnet. - The available data for Jsonnet is described in the documentation and accessible via the ctx
object. - See the documentation for a full example of the available fields [Jsonnet templating](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#jsonnet-templating).freezing-planet-21392
08/08/2025, 12:12 PMbrief-egg-61061
08/08/2025, 12:13 PMbrief-egg-61061
08/08/2025, 12:14 PMctx
object available to Jsonnet templates in webhooks for registration flows. You can use this as a reference to create a Jsonnet function that outputs all keys and values from ctx
. Here is a Jsonnet template that simply returns the entire ctx
object, which will include all available keys and values: jsonnet function(ctx) ctx
If you want to explicitly list all keys and values as shown in the documentation's example, you can structure your Jsonnet like this (based on the provided sample): jsonnet function(ctx) { flow: ctx.flow, identity: ctx.identity, request_cookies: ctx.request_cookies, request_headers: ctx.request_headers, request_method: ctx.request_method, request_url: ctx.request_url }
This will output all the top-level keys from the ctx
object, and their full values, as provided by Ory during the webhook execution. For a detailed example of the structure and available fields, see the documentation's expanded example under "Jsonnet templating" [Jsonnet templating](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#jsonnet-templating).