boundless-artist-2317
11/06/2024, 2:54 PMctx
object of a webhook request?brief-egg-61061
11/06/2024, 2:54 PMbrief-egg-61061
11/06/2024, 2:54 PMctx
object of a webhook request in Ory. The ctx
object in Ory webhook requests can contain various metadata depending on the specific flow and context. Here's an overview of the key metadata that can be passed: 1. Flow information: - `flow`: Contains details about the current flow, including id
, type
, expires_at
, issued_at
, and request_url
[Ory Docs: Webhook Integration](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#jsonnet-templating) 2. Identity information: - `identity`: Includes details about the user, such as id
, traits
, recovery_addresses
, verifiable_addresses
, and more [Ory Docs: Webhook Integration](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#jsonnet-templating) 3. Request information: - `request_headers`: Contains various HTTP headers from the original request [Ory Docs: Webhook Integration](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#define-http-request) - `request_method`: The HTTP method of the original request - `request_url`: The URL of the original request 4. Template-specific data: - `recipient`: The email address or phone number of the recipient (for email/SMS templates) [Ory Docs: Email HTTP](https://www.ory.sh/docs/kratos/self-hosted/email-http#request-configuration) - `template_type`: The type of template being used - `template_data`: Data specific to the template, which varies based on the flow (e.g., recovery_url, verification_code, etc.) 5. Transient payload: - `transient_payload`: Custom data that can be passed along to webhooks [Ory Docs: Webhook Integration](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#jsonnet-templating) It's important to note that the available metadata can vary depending on the specific flow (e.g., registration, login, recovery) and the point at which the webhook is triggered (before or after the flow). The exact structure and content of the ctx
object may differ based on these factors. To use this metadata in your webhook, you can create a Jsonnet template that accesses the relevant fields from the ctx
object. For example: jsonnet function(ctx) { userId: ctx.identity.id, email: ctx.identity.traits.email, flowType: ctx.flow.type, customData: ctx.transient_payload.custom_data }
This template demonstrates how to access various metadata fields from the ctx
object in a webhook request.boundless-artist-2317
11/06/2024, 3:00 PMopenid
scope during SSO or Social-Sign In registration?boundless-artist-2317
11/06/2024, 3:00 PMopenid
scope during SSO or Social-Sign In registration?brief-egg-61061
11/06/2024, 3:00 PMbrief-egg-61061
11/06/2024, 3:00 PM