<@U04UQ68083H> what metadata can I pass via the `c...
# ory-copilot
b
@chilly-king-10285 what metadata can I pass via the
ctx
object of a webhook request?
b
A message from kapa.ai
Based on the knowledge sources provided, I can answer your question about the metadata that can be passed via the
ctx
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:
Copy code
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.
b
How do I extract a user's name from the
openid
scope during SSO or Social-Sign In registration?
@chilly-king-10285 How do I extract a user's name from the
openid
scope during SSO or Social-Sign In registration?
b
A message from kapa.ai
New message text here