<@U04UQ68083H> what are all the available template...
# ory-copilot
r
@chilly-king-10285 what are all the available template_type in otp context?
c
A message from kapa.ai
In the context of OTP (One-Time Password) flows in Ory (such as login, registration, recovery, and verification via code), the available
template_type
values correspond to the different message templates used for sending codes to users. According to the knowledge sources, the following
template_type
values are available: -
recovery_code.valid
-
recovery_code.invalid
-
verification_code.valid
-
verification_code.invalid
-
login_code.valid
-
registration_code.valid
-
recovery.valid
-
recovery.invalid
-
verification.valid
-
verification.invalid
However, specifically for OTP (one-time code) flows, the most relevant
template_type
values are: -
login_code.valid
(for login via OTP) -
registration_code.valid
(for registration via OTP) -
recovery_code.valid
and
recovery_code.invalid
(for account recovery via OTP) -
verification_code.valid
and
verification_code.invalid
(for account verification via OTP) These template types are used for both email and SMS delivery, depending on your configuration. Each template type has its own set of available variables and can be customized as needed. For more details and the full list of variables per template, see the documentation on [available variables](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#available-variables) and [built-in templates](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates) in Ory Identities. For SMS, only the following templates support an SMS variant: -
recovery_code
-
verification_code
-
login_code
These can be further specified as
recovery_code.valid
,
verification_code.valid
, and
login_code.valid
for SMS delivery contexts [Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms). Summary of OTP-related template_type values: -
login_code.valid
-
registration_code.valid
-
recovery_code.valid
-
recovery_code.invalid
-
verification_code.valid
-
verification_code.invalid
Other templates like
recovery.valid
,
recovery.invalid
,
verification.valid
, and
verification.invalid
are used for link-based flows, not code-based (OTP) flows. If you need to configure or reference these in your HTTP or SMS delivery setup, use the above
template_type
values as appropriate for your OTP context. [Available variables](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#available-variables) [Send emails using an HTTP server](https://www.ory.sh/docs/kratos/emails-sms/sending-emails-smtp#send-emails-using-an-http-server) [Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms)
r
@chilly-king-10285 but the
template_type
I received is
registration_code_valid
c
A message from kapa.ai
The
template_type
value you received,
registration_code_valid
, is correct and expected in the context of OTP (one-time code) registration flows in Ory. Ory uses the following naming convention for template types: -
registration_code_valid
is the template type used when sending a registration code to a user during the registration flow via OTP (one-time code). This is confirmed in the API schema and configuration examples, where
registration_code_valid
is listed as a valid template type for messages sent by the courier service in Ory Kratos. The same applies to other flows, such as
login_code_valid
,
recovery_code_valid
, and
verification_code_valid
for their respective OTP flows. You can see this in the API reference, where
registration_code_valid
is explicitly listed as a possible value for the
template_type
field in courier messages: > template_type: > ... > registration_code_valid TypeRegistrationCodeValid > ... > [Ory API Reference – getCourierMessage](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json) Additionally, the documentation on custom email templates also refers to
registration_code.valid
as the template for registration via a one-time code, and the API uses the underscore format (
registration_code_valid
) for the template type value in the message object. So, receiving
registration_code_valid
as the
template_type
is expected and aligns with Ory's internal naming for OTP registration messages.
r
@chilly-king-10285 under what scenario will Kratos sending the verification_code_valid / invalid
c
A message from kapa.ai
Ory Kratos will send the
verification_code_valid
template when a user initiates an address verification flow (such as email or phone verification) and the verification method is set to code. This message contains the verification code and is sent to the user so they can complete the verification process by entering the code in your application's UI. The
verification_code_invalid
template is sent if you have enabled notifications to unknown recipients (i.e., when someone tries to verify an address that is not registered in your system). This is a security feature to prevent account enumeration attacks. By default, this feature is disabled, but you can enable it in your configuration (
notify_unknown_recipients: true
) to have Kratos send a notification to the attempted (but unregistered) address, informing them of the verification attempt [Attempted verification notifications](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#attempted-verification-notifications). Summary: -
verification_code_valid
is sent when a user requests verification (via code) for a registered address. -
verification_code_invalid
is sent to an unregistered address if someone attempts verification and you have enabled notifications to unknown recipients. References: - [Address verification flow and templates](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation) - [Custom email templates and template types](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates) - [Attempted verification notifications](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#attempted-verification-notifications)
r
@chilly-king-10285 is there any available struct i can use from the sdk?
c
A message from kapa.ai
I'm sorry, but the knowledge sources provided do not contain explicit information about available structs in the Ory SDK for handling
verification_code_valid
or related templates. The documentation and API references describe the API endpoints, message formats, and template types, but do not detail specific SDK structs or code examples for these templates. If you need to interact with courier messages, you can refer to the API response schema for courier messages, which includes fields like
id
,
status
,
type
,
recipient
,
body
,
subject
,
template_type
, etc. However, there is no direct mention of a ready-to-use struct in the SDK in the provided sources. You may need to consult the SDK documentation or source code directly for struct definitions related to courier messages or templates<sup>[Ory API Reference – getCourierMessage](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json)</sup>.