Hello, I’m trying to set our own email templates. ...
# ory-network
b
Hello, I’m trying to set our own email templates. I thought I understood where to start but I’m stuck. I need to change just the
recovery/valid
templates, I haven’t found a way to do it in the web interface. So I saw some references here on slack, https://ory-community.slack.com/archives/C02MR4DEEGH/p1656941173353769 My end game is: • I have a template in S3 (
email.body.gotmpl
) • I want to change the from name (
New From Name
) • Do I need to set plaintext?
Copy code
ory patch project 218f84c4-ee48-4710-b73f-xxxxxxxxxxxxxxxx \                                                                                                                                       
        --add '/services/identity/config/templates/recovery/valid={"from_name": "New From Name"}'
I tried patching and the result is:
Copy code
The request was malformed or contained invalid parameters
Unable to apply JSON Patch: add operation does not apply: doc is missing path: "/services/identity/config/templates/recovery/valid": missing value
I have downloaded the whole config file from the Cloud, But I am not sure how to format the new fields. Should I look here https://www.ory.sh/docs/kratos/concepts/email-sms#sender-address-and-template-customization ? Or here https://www.ory.sh/docs/cli/ory-update-project#examples
This is what I’ve downloaded from the cloud
p
Hi @bored-coat-26363 You can update the singular key as well without needing the whole configuration file. https://www.ory.sh/docs/guides/cli/config-with-cli#patch-configuration
The from name is just plaintext, but with the templates we have a section for each part of the email such as the subject and body (in html and plaintext). Plaintext is always needed as a fallback and thus when updating an email template you need to provide both.
With the subject it is optional
Copy code
'/services/identity/config/templates/recovery/valid=
this path is incorrect since
valid
here is an object containing the following structure:
Copy code
valid:
  email:
    body:
    # plaintext and html are required when overriding the body
      html: <https://some-remote-resource/gotmpl>
      plaintext: <base64://SGV5IHlvdSBkZWNvZGVkIG1lIDop>
    # optional
    subject: <file://some-file/subject.gotmpl>
b
Thanks, but still I have issues: 1. You wrote
'/services/identity/config/templates/recovery/valid=
But it looks like the cloud config has actually:
/services/identity/config/courier/templates/recovery/valid=
Is this correct? 2. I tried with the path with ``courier`` (the first one didn’t work at all), annd When pushing this:
Copy code
{
  "email": {
    "body": {
      "html": "<https://aaaa-resources.s3.amazonaws.com/courier-templates/recovery/valid/email.body.gotmpl>",
      "plaintext": "<base64://xxxxx>"
    },
    "subject": "<base64://xxxxx>"
  }
}
I get the error:
Copy code
The request was malformed or contained invalid parameters
URL `<https://ory-public-resources.s3.amazonaws.com>` is not allowed for `courier.templates.recovery.valid.email.body.html`.
🤷
I was able for now to use a base64 on that field instead, but would rather use the remote link
p
oh i see, it is possible we deny remote URL at the moment on the cloud
due to security risks
I will open an issue so we can track this
🙌 1
e
@proud-plumber-24205 I found this issue with Github as well, Could you add this to your task as well ?
p
@elegant-airline-89652 do you mean github URLs as well?
would it be possible to add to the issue your findings?
e
Yes . Github urls as well. Sure I will add my findings.