Added in 24.10.
You can customize the emails sent to members on behalf of the community when there is an update.
With GraphQL, you can:
- Retrieve email templates
- Choose the email template you want to update
- Update email templates
- Remove text keys using GQL as desired
Before you can update the email template, you need to know the email template, its text keys, and its default values.
Based on this information, you can update the following in the email template:
- The subject of the email
- Body of the email
Khoros provides customers with a variety of email templates, including their default values for reference. Customers can modify the text of these templates based on their preferences.
Furthermore, Khoros offers a mapping matrix that associates component IDs with the respective email templates.
Email Templates Mapping Matrix with the Component ID
The mapping matrix of the email templates and component ID are:
Template Name | componentId |
---|---|
AcceptAsSolutionReminder | mail.template.acceptAsSolutionReminder |
AnswerAcceptedAsSolution | mail.template.answerAcceptedAsSolution |
AwardUserBadge | mail.template.awardUserBadge |
ContentMentions | mail.template.contentMentions |
DigestNotification | mail.template.digestNotification |
EmailChangeConfirm | mail.template.emailChangeConfirm |
EmailVerifyConfirm | mail.template.emailVerifyConfirm |
ForgotPassword | mail.template.forgotPassword |
ImmediateGeneral | mail.template.immediateGeneral |
InvitedUserRegistration | mail.template.invitedUserRegistration |
Likes | mail.template.likes |
MembershipApproveRequest | mail.template.membershipApproveRequest |
MembershipDenyRequest | mail.template.membershipDenyRequest |
MembershipInviteMember | mail.template.membershipInviteRequest |
MembershipUserRequest | mail.template.membershipUserRequest |
Mentions | mail.template.mentions |
MessageDeletionNotification | mail.template.messageDeletionNotification |
MessageEditNotification | mail.template.messageEditNotification |
MessageMoveNotification | mail.template.messageMoveNotification |
MessagePostConfirm | mail.template.messagePostConfirm |
ModeratorNotification | mail.template.moderatorNotification |
OccasionInvite | mail.template.occasionInvite |
OccasionInvitePrivateMessage | mail.template.occasionInvitePrivateMessage |
OccasionReminder | mail.template.occasionReminder |
PmNotification | mail.template.pmNotification |
RegistrationConfirm | mail.template.registrationConfirm |
SolutionToQuestion | mail.template.solutionToQuestion |
UserRankChange | mail.template.userRankChange |
AcceptAsSolutionReminder
componentId: mail.template.acceptAsSolutionReminder
Key | Default value (English) |
---|---|
AcceptAsSolutionReminder.subject | Did you get the answer you needed on {communityTitle}? |
AcceptAsSolutionReminder.body.html | Your topic recently received {repliesCount} {repliesCount, plural, one{reply} other{replies}} on {communityTitle}. If you got the answer you needed, mark it as the accepted solution. |
AcceptAsSolutionReminder.link.html | View, the {repliesCount, plural, one{reply} other{replies}} |
AcceptAsSolutionReminder.body.text | Your topic recently received {repliesCount} {repliesCount, plural, one{reply} other{replies}} on {communityTitle}. If you got the answer you needed, mark it as the accepted solution. |
AcceptAsSolutionReminder.link.text | View, the {repliesCount, plural, one{reply} other{replies}}: {messageUrl} |
Permission for Email Template Update
To update any email template, members must have a role with the Edit community settings permission set to Grant.
Retrieve the Email Templates
You can retrieve the content of any template you want using the key of the Email Template Text keys.
For this example, we will retrieve the content of the ANSWER_ACCEPTED_AS_SOLUTION
template using the below GraphQL query.
query MyQuery {
mailTemplates(constraints: {templateName: {eq: ANSWER_ACCEPTED_AS_SOLUTION}}) {
edges {
node {
id
templateBodyHtml
templateBodyText
templateName
templateSubject
}
}
}
}
GraphQL response:
{
"data": {
"mailTemplates": {
"edges": [
{
"node": {
"id": "mail_template:2",
"templateBodyHtml": "...",
"templateBodyText": "...",
"templateName": "ANSWER_ACCEPTED_AS_SOLUTION",
"templateSubject": "..."
}
}
]
}
}
}
Update an Email Template
To update or override the text keys of an email template, use the createOrUpdateTextOverride
mutation with the component ID information.
The fields of the mutation are as follows:
Field | Description | Required |
---|---|---|
componentId | The ID of the email template you want to update. | Required |
locale | An IETF BCP 47 language tag. Some of the supported values:fr-FR : Frenchde-DE : Germanit-IT : Italianes-ES : Spanishen-US : US English |
Required |
values | The key-value pair you want to update for the key of the email template | Required |
For example, use the below GraphQL mutation and variables to override the subject (AnswerAcceptedAsSolution.subject
) of the “AnswerAcceptedAsSolution” template (component ID: mail.template.AcceptedAsSolution
) from the default value - “Your solution has been accepted on Atlas” to a new value: “Your solution received an appreciation on Atlas.”
mutation createOrUpdateTextOverride($values:JSON!){
createOrUpdateTextOverride(componentId:"mail.template.answerAcceptedAsSolution", locale:"en-us",values:$values){
result{
locale
texts
lastUpdatedTime
}
errors{
...on CreateOrUpdateTextFailedError{
message
fields
name
}
}
}
}
The variables for the mutation:
{
"values":{"AnswerAcceptedAsSolution.subject":"Your solution received an appreciation on {communityTitle}"}
}
GraphQL response:
{
"data": {
"createOrUpdateTextOverride": {
"result": {
"locale": "en-US",
"texts": {
"mail.template.answerAcceptedAsSolution": {
"AnswerAcceptedAsSolution.subject": "Your solution received an appreciation on {communityTitle}"
}
},
"lastUpdatedTime": 1730297272000
},
"errors": null
}
}
}
After you have updated the email template, whenever a member’s solution has been accepted, that member will receive the email with the updated text keys.
Remove a Text Key from a Mail Template
To remove a text key from a mail template (component ID), use the removeTextOverride
mutation with the below fields.
The fields of the mutation are as follows:
Field | Description | Required |
---|---|---|
componentId | The ID of the email template in which you want to remove the key information. | Required |
locale | An IETF BCP 47 language tag. Some of the supported values:fr-FR : Frenchde-DE : Germanit-IT : Italianes-ES : Spanishen-US : US English |
Required |
key | The text key that you want to remove from the email template. | Required |
For this example, use the below GraphQL mutation to remove the ForgotPassword.subject
text key from the mail.template.forgotPassword</
ATLAS
Comments