# The following interpolation key is invalid: name

**URL:** <https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477>\
**Category:** Support\
**Created:** [May 10, 2023, 1:29am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477 "2023-05-10T01:29:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [May 10, 2023, 1:29am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/1 "2023-05-10T01:29:05Z")

</div>

I’m trying to update `system_messages.welcome_tl1_user.text_body_template` and address the user’s name in the message, but getting the error: `The following interpolation key is invalid: name`:

 ![image](https://global.discourse-cdn.com/meta/original/4X/7/a/c/7acdd19ca4f1759e18a5e78fe5c3dd0652b8dde0.png)

Is there a library or doc that I’m missing where we can see which variables can be used in which messages?

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [May 10, 2023, 4:11am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/3 "2023-05-10T04:11:28Z")

</div>

i think this may be your answer:

> [@Available interpolation key(s)](https://meta.discourse.org/t/available-interpolation-key-s/126130/2):
>
> The only ones available are the ones in the original translation phrase. That’s it.

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [May 10, 2023, 11:13am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/4 "2023-05-10T11:13:16Z")

</div>

Thanks Lilly, that’s a bummer. It would be nice to address the user’s name in some of them.

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [May 10, 2023, 2:58pm UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/5 "2023-05-10T14:58:46Z")

</div>

This is not my area but taking a look at [`ALLOWED_CUSTOM_INTERPOLATION_KEYS`](https://github.com/discourse/discourse/blob/main/app/models/translation_override.rb) it appears you can use additional values for certain messages.

In particular:

```plaintext
    %w[system_messages.welcome_user] => %w[username name name_or_username],

```

I think if we changed this to:

```plaintext
    %w[system_messages.welcome_] => %w[username name name_or_username],

```

It would let you use those for other welcome messages. I’ll ask around.

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [May 10, 2023, 5:33pm UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/6 "2023-05-10T17:33:06Z")

</div>

In theory we should be able to add all `system_messages.*` keys as long as they have `subject_template` and `text_body_template` subkeys. Because all of them should be handled by the `SystemMessage` class which adds `username, name, name_or_username` as additional interpolation keys.

> <https://github.com/discourse/discourse/blob/6fa9a8990d07f942ee52b3d721135b84d79d8a7c/lib/system_message.rb#L27-L36>

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [May 11, 2023, 1:09am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/7 "2023-05-11T01:09:01Z")

</div>

there we go 🙂

> [@Interpolation Keys for Customizing Text and System Email Templates](https://meta.discourse.org/t/interpolation-keys-for-customizing-text-and-email-templates/264604):
>
> bookmark This guide provides a detailed overview of interpolation keys used for customizing text and system email templates in Discourse. person_raising_hand Required user level: Administrator While [Customizing text in Discourse](https://meta.discourse.org/t/customize-any-text-in-discourse/36092) or [Customizing specific email templates](https://meta.discourse.org/t/customize-specific-email-templates/88323) you may have noticed that there are placeholder variables available in some templates. In Discourse we call these Interpolation Keys. Understanding interpolation keys Interpolation keys are placeholders available in cert…

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [May 11, 2023, 1:29am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/8 "2023-05-11T01:29:36Z")

</div>

This is indeed the way! Thank you so much for your efforts, Lilly—truly appreciated!

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [May 11, 2023, 1:33am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/9 "2023-05-11T01:33:04Z")

</div>

heh well i didn’t do anything other than copy and paste. those other good folks @gerhard, @supermathie and @SaraDev deserve the credit 👏 😅

---

<div class="post-metadata">

**Author:** ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)\
**Post date:** [May 11, 2023, 1:33am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/10 "2023-05-11T01:33:41Z")

</div>

They say it takes a village!

---

<div class="post-metadata">

**Author:** ![mjr4684](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@mjr4684](https://meta.discourse.org/u/mjr4684)\
**Post date:** [May 12, 2023, 9:07pm UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/11 "2023-05-12T21:07:38Z")

</div>

Could this behavior be extended to chat so notification emails can include the user’s name in the subject instead of their username?

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [May 13, 2023, 12:06am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/12 "2023-05-13T00:06:11Z")

</div>

you would have to edit the chat email text and change the key from username to their full name. but i have no idea if this is possible. the chat configuration is not my forte. i would go to `settings-customize-email` and search for a chat email template in the top drop down menu. all the editable email templates are in that drop down.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [June 12, 2023, 12:06am UTC](https://meta.discourse.org/t/the-following-interpolation-key-is-invalid-name/264477/13 "2023-06-12T00:06:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
