-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: transient payload in email templates
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -508,3 +508,41 @@ Since metadata is not validated by Ory Identities, missing entries or unexpected | |
process. If the system encounters errors in the rendering process, Ory Identities uses the default templates. | ||
|
||
::: | ||
|
||
### Transient payload in templates | ||
|
||
The transient payload allows you to pass additional data along with certain self-service flows. Transient payloads can be used for | ||
passing temporary information to your email template without storing it permanently. | ||
|
||
The following `example_key` transient payload | ||
|
||
``` | ||
... | ||
traits: { | ||
email: "[email protected]", | ||
}, | ||
transient_payload: { | ||
example_key: "This is an example value" | ||
}, | ||
... | ||
``` | ||
|
||
can be accessed in the email template using `{{index .TransientPayload "example_key"}}` | ||
|
||
```gotmpl | ||
<h1>Recovery Details</h1> | ||
<p>To: {{.To}}</p> | ||
<p>Recovery URL: {{.RecoveryURL}}</p> | ||
<p>Transient Payload: {{index .TransientPayload "example_key"}}</p> | ||
``` | ||
|
||
This results into the following email to be sent to the user. | ||
|
||
```gotmpl | ||
<h1>Recovery Details</h1> | ||
<p>To: [email protected]</p> | ||
<p>Recovery URL: https://example.com/recover</p> | ||
<p>Transient Payload: This is an example value</p> | ||
``` |