Skip to main content

Use webhooks to integrate with The Ory Network

Thanks to webhooks, you can easily integrate with external services, for example ERP or CRM. Ory Identities (Ory Kratos) allows you to tie the execution of custom calls to external systems to self-service user flows.


Self-service user flows are actions that the users of a system perform on their own, without the need of administrative intervention.

By triggering custom logic at specific points of self-service user flows, you can custom-tailor your users' customer experience, trigger usage data collection to learn more about how your system is used, and more.

Follow these steps to add a webhook that enables integration with Mailchimp. With this integration in place, the system sends a welcome email message to all newly registered users.

  1. Get the Ory Identities config with Ory CLI:

    ## List all available projects
    ory list projects

    ## Get config
    ory get identity-config <project-id> --format yaml > identity-config.yaml
  2. Create a request body Jsonnet snippet and encode it with Base64:

    Mailchimp request body
    function(ctx) {
    key: "<Your-Api-Key>", // Mailchimp requires passing the API key in request body.
    message: {
    from_email: "[email protected]",
    subject: "Hello from Ory",
    text: "Welcome to Ory! Have fun and happy hacking!",
    to: [
    email: ctx.identity.verifiable_addresses[0].value,
    type: "to"
  3. Add the webhook configuration to the downloaded Ory Identities (Ory Kratos) configuration file.

    registration: # Defines for which flow triggers the hook.
    after: # Defines the point at which the hook runs.
    password: # When method is defined, the hook is triggered only for this particular method and flow.
    - hook: web_hook
    method: POST
    # Encode the Jsonnet with Base64 and add the encoded string to 'body'.
    body: base64://ENCODED_JSONNET
  4. Update the Ory Identities configuration using the file you worked with:

    ory update identity-config <project-id> --file updated_config.yaml

Read this document to learn more about hooks in The Ory Network.