<@U04UQ68083H> What are the parameters send in the...
# ory-copilot
f
@chilly-king-10285 What are the parameters send in the request body of a webhook?
b
A message from kapa.ai
The webhook request body parameters in Ory vary depending on the specific webhook type and context. Here's an overview of what's typically included: ## General Webhook Context Object For most Ory Actions webhooks, a
ctx
object is included in the request body with the following components: - `flow`: Contains information about the current flow (registration, login, etc.) - `request_headers`: Contains HTTP headers from the original request - `request_method`: The HTTP method used in the original request - `request_url`: The URL of the original request - `identity`: (Only in "after" execution paths) Contains user identity information - `transient_payload`: Custom data that can be passed along to webhooks [Integrate with Ory Cloud through webhooks](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#jsonnet-templating) provides a detailed example of this context object. ## OAuth2 Token Webhook Payload For OAuth2 token webhooks, the payload includes:
Copy code
json {   "session": {     "id_token": {       "id_token_claims": { ... },       "headers": { ... },       "username": "",       "subject": "foo"     },     "extra": {},     "client_id": "app-client",     "consent_challenge": "",     "exclude_not_before_claim": false,     "allowed_top_level_claims": []   },   "request": {     "client_id": "app-client",     "granted_scopes": ["offline", "openid", "hydra.*"],     "granted_audience": [],     "grant_types": ["authorization_code"],     "payload": {       "assertion": ["eyJhbGciOiJIUzI..."]     }   } }
[Customizing claims with OAuth2 webhooks](https://www.ory.sh/docs/hydra/guides/claims-at-refresh#webhook-payload) provides more details on this payload structure. ## Directory Sync Webhook Payload For directory synchronization webhooks, the payload includes:
Copy code
json {   "directory_id": "58b5cd9dfaa39d47eb8f5f88631f9a629a232016",   "event": "user.created",   "tenant": "ory",   "product": "polis",   "data": {     "id": "038e767b-9bc6-4dbd-975e-fbc38a8e7d82",     "first_name": "Deepak",     "last_name": "Prabhakara",     "email": "<mailto:deepak@ory.sh|deepak@ory.sh>",     "active": true,     "raw": {...}   } }
[Webhooks in Polis Directory-sync](https://www.ory.sh/docs/polis/directory-sync/webhooks) provides more information on these webhooks. Additionally, many Ory API endpoints support a
transient_payload
parameter that allows you to pass custom data to webhooks, which can be useful for extending functionality with your own business logic.