Email templates within Kratos, if we were to use a...
# talk-kratos
t
Email templates within Kratos, if we were to use a remote source for the template, is there a way to pass information about who the user is to the remote source? We're looking at being able to differ/white label the template based on the type of user. Having a service create the templates that Kratos uses would allow this, but only if that service has an awareness of who the user is that the email is for
Alternatively, is there a way to not use Kratos Courier, and send an event somewhere for our own service to handle email/sms dispatch?
Hey @magnificent-energy-493 Just bumping this so it doesn't get lost in the channel 🙂
m
Hey Adam, thanks for bumping 🙂 Is the “Identity Attribute” enough information on the user to white label the templates in your case? https://docs-17lqswjen-ory.vercel.app/docs/kratos/concepts/email-sms#the-identity-attribute
This object is a map containing all the attributes of an identity, such as
id
,
state
,
recovery_addresses
,
verifiable_addresses
and
traits
.
t
Are the traits passed through in the request when requesting a remote template, or only at the point of template rendering? (I assume it's the latter) We have a service that handles all our email and notification templating, and we'd like to keep this consistent within our auth flow too. In an ideal world, Kratos will send an event/add to a queue, for our messaging service to then handle the templating and dispatch. I guess one option is to include the required whitelabel fields within the traits, and then have conditionals in the template to alter the content? For example;
Copy code
{{- if .Identity.traits.custom_logo -}}
# Use custom logo
{{- else -}}
# Use default logo 
{{- end -}}
but might mean bloating out the traits with data that's not necessarily important I've not seen what the data is like yet, but if Kratos Courier wasn't running, could we just consume from the table that courier is consuming from, or is Courier doing some heavy lifting to process the message first?