https://www.ory.sh/ logo
#talk-kratos
Title
# talk-kratos
g

glamorous-pencil-84842

04/07/2022, 8:07 AM
Hello, I have a question related to Web-Hooks in Kratos. Can I pass data from the user identity to the body for an after registration hook? Something such as id or traits
s

steep-lamp-91158

04/07/2022, 8:52 AM
you can find some examples here: https://www.ory.sh/docs/kratos/self-service/hooks#web-hooks that should get you started 😉
a

ancient-intern-85807

04/07/2022, 10:49 AM
Just to add on to what Patrik mentioned, you will have it done in your jsonnet file. Mine goes something like this.
Copy code
function(ctx) {
    type: 'after_registration',
    user_id: ctx.identity.id,
    identity: ctx.identity,
    flow: ctx.flow,
    request: {
        url: ctx.request_url,
        method: ctx.request_method,
        headers: ctx.request_headers,
    },
}
you can freely pass the
ctx.identity
or other possible variables as well as take a much precise data from those like
ctx.identity.id
(don't mind the
request
part, I just wanted to see all the possible data that can be passed via webhooks).
🙏 1
g

glamorous-pencil-84842

04/07/2022, 1:56 PM
thanks for the answers guys, really helpful 😄
2 Views