fierce-nail-76747
11/12/2024, 8:21 PMbrief-egg-61061
11/12/2024, 8:21 PMbrief-egg-61061
11/12/2024, 8:22 PMctx.body
. However, there isn't a direct way to access the rendered HTML content.
3. One potential workaround would be to include both the plaintext and HTML versions in your template configuration, and then access them in your Jsonnet template. For example:
jsonnet
function(ctx) {
recipient: ctx.recipient,
template_type: ctx.template_type,
body: {
plaintext: ctx.body,
html: if "template_data" in ctx && "body" in ctx.template_data then ctx.template_data.body.html else null
}
}
This approach assumes that the HTML content is available in ctx.template_data.body.html
, which may not be the case by default.
Unfortunately, based on the provided knowledge sources, there isn't a straightforward way to load the HTML templates within the request body when using the HTTP delivery strategy. The current implementation seems to focus on providing the plaintext version through the Jsonnet context.
If you need to include the HTML version in your HTTP requests, you might need to consider one of these options:
1. Modify the Ory Kratos source code to include the HTML version in the Jsonnet context for HTTP delivery.
2. Use the SMTP delivery strategy instead, which does process the HTML templates.
3. Create a custom HTTP endpoint that receives the plaintext version and generates an HTML version based on your requirements.brief-egg-61061
11/12/2024, 8:22 PMctx.body
. However, there isn't a direct way to access the rendered HTML content. 3. One potential workaround would be to include both the plaintext and HTML versions in your template configuration, and then access them in your Jsonnet template. For example: jsonnet function(ctx) { recipient: ctx.recipient, template_type: ctx.template_type, body: { plaintext: ctx.body, html: if "template_data" in ctx && "body" in ctx.template_data then ctx.template_data.body.html else null } }
This approach assumes that the HTML content is available in ctx.template_data.body.html
, which may not be the case by default. Unfortunately, based on the provided knowledge sources, there isn't a straightforward way to load the HTML templates within the request body when using the HTTP delivery strategy. The current implementation seems to focus on providing the plaintext version through the Jsonnet context. If you need to include the HTML version in your HTTP requests, you might need to consider one of these options: 1. Modify the Ory Kratos source code to include the HTML version in the Jsonnet context for HTTP delivery. 2. Use the SMTP delivery strategy instead, which does process the HTML templates. 3. Create a custom HTTP endpoint that receives the plaintext version and generates an HTML version based on your requirements. For the most up-to-date and accurate information on this topic, I recommend reaching out to the Ory community or opening an issue on the [Ory Kratos GitHub repository](https://github.com/ory/kratos) to discuss potential solutions or feature requests.