Skip to main content

End-User Self-Delete Email Template with brainCloud Substitutions

Create a SendGrid Template for end-users Self-Deletion

Jason Liang avatar
Written by Jason Liang
Updated this week

brainCloud supports user-initiated account deletion. For the deletion email sent to end-users, instead of using the default plain text template from the brainCloud portal, you can create a custom rich-content SendGrid template that includes additional user details using brainCloud-provided substitutions.

To set this up, follow the steps below.

Prerequisites:
You have a SendGrid account and have integrated it with your brainCloud app.

  • Go to your SendGrid account and create a Dynamic Template. Name it as you wish, Self-Serve-Player-Account-Deletion will be used as the example in this guide.

  • Add a version to this dynamic template.

  • Select a Blank Template under the Your Email Designs tab.

  • From Your Editing Experience, select the Code Editor option

  • Copy the HTML code below and paste it into the code editor on that page, covering all the original code. (Note the available substitutions for self-deletion are listed at the end of this article.) You may adjust the code as appropriate for your use case.

    <html>
    <head>
    <meta charset="UTF-8">
    <title>Account Deletion</title>
    </head>
    <body style="font-family: Arial, sans-serif; background-color: #ffffff; margin: 0; padding: 0;">
    <center style="width: 100%; background-color: #ffffff;">
    <table width="100%" cellpadding="0" cellspacing="0" border="0" style="max-width: 400px; margin: auto; border: 1px solid #e0e0e0;">
    <tr>
    <td style="padding: 20px;">
    <div style="text-align: center;">
    <img src="{{appIcon}}" alt="App Icon" style="width: 80px; height: 80px; border-radius: 20px; background: #ccc;">
    <h3 style="margin: 10px 0;">{{appName}}</h3>
    <h4 style="margin: 10px 0;">Account Deletion</h4>
    <p style="color: #555;">Please review the details below and choose carefully if you want to proceed.</p>
    </div>
    <hr style="border: none; border-top: 1px solid #ccc; margin: 20px 0;">
    <table width="100%" cellpadding="6" cellspacing="0" style="font-size: 14px; color: #333;">
    <tr><td>Player Name</td><td style="text-align: right;"><strong>{{userName}}</strong></td></tr>
    <tr><td>Account Created</td><td style="text-align: right;"><strong>{{accountCreated}}</strong></td></tr>
    <tr><td>Last Login</td><td style="text-align: right;"><strong>{{lastLogin}}</strong></td></tr>
    <tr><td>Login Count</td><td style="text-align: right;"><strong>{{loginCount}}</strong></td></tr>
    <tr><td>Amount Spent</td><td style="text-align: right;"><strong>{{amountSpent}}</strong></td></tr>
    </table>
    <hr style="border: none; border-top: 1px solid #ccc; margin: 20px 0;">
    <p style="text-align: center; color: #777;">Profile ID</p>
    <p style="text-align: center; color: #999;">{{profileId}}</p>
    <div style="text-align: center; margin: 20px 0;">
    <a href="{{webUrl}}" style="background-color: #0073FF; color: #fff; padding: 12px 24px; text-decoration: none; border-radius: 6px; display: inline-block;">Go to Account Deletion Page</a>
    </div>
    <p style="text-align: center; font-size: 13px; color: #888;">
    Customer Service<br>
    <a href="mailto:customer-service@indiedevgame.com" style="color: #888;">{{customerServiceUrl}}</a><br>
    <a href="{{termsAndConditionsUrl}}">Terms</a> | <a href="{{privacyUrl}}">Privacy Policy</a><br>
    {{address}}
    </p>
    </td>
    </tr>
    </table>
    </center>
    </body>
    </html>

  • From the Settings menu, set the Template Version Name and Subject, then click Save. If the template has multiple versions, be sure to mark this version as active.

  • SendGrid setup is complete. Now, go to the brainCloud portal and link this template to the Delete Account email. Once configured, send a test request—you should receive a test email if everything is set up correctly. (Note: To display embedded images in your email, you may need to configure domain authentication in your SendGrid account.)

The following substitutions are available when creating self-delete email templates:

{{appName}} the name of the app, as data filled in brainCloud

{{profileId}} the profile id of the user

{{userName}} the name of the end-user (note - not available at the beginning of account creation, so not useful for use in email verification templates)

{{userEmail}} the user's email

{{userCountryCode}} the user's country code, as detected from their device

{{userLanguage}} the user's language, as detected from their device

{{webUrl}} a web-url passed into the message. For example - for email verification or password reset

{{icon}} – The player’s braincloud Icon, if any exists.

{{appIcon}} - the app icon in braincloud , if any

{{accountCreated}} - The date that this user’s account was created

{{lastLogin}} – - time stamp of last login

{{loginCount}} - Number of times this account logged in

{{XPLevel}} - The braincloud XP level of this account

{{XPPoints}} - The exact number of XP points for this account in braincloud.

{{amountSpent}} - Amount in USD that braincloud has stored as the user’s total spent.

{{virtualCurrency_Yadda}} - the amount for the given virtual currency, where Yadda is exactly equal to the Virtual Currency Name in Braincloud (case sensitive), no spaces. There can be multiple of these. eg.

  • {{virtualCurrency_Coins}}

  • {{virtualCurrency_Bars}}

  • {{virtualCurrency_Gems}}

{{homepageUrl}} - The Homepage url, if configured in Self-service Branding

{{feedbackUrl}} - The Feedback url, if configured in Self-service Branding

{{exitSurveyUrl}} - The Exit Survey url, if configured in Self-service Branding

{{customerServiceUrl}} - The customer service mailto/url, if configured in Self-service Branding

{{termsAndConditionsUrl}} - The Terms & Conditions url, if configured in Self-service Branding

{{privacyUrl}} - The Privacy Policy url, if configured in Self-service Branding

{{address}} - The business address, if configured in Self-service Branding

{{city}} - The business city, if configured in Self-service Branding

{{state}} - The business State or Province, if configured in Self-service Branding

{{country}} - The business Country, if configured in Self-service Branding

{{zip}} - The business Zip or Postal Code, if configured in Self-service Branding

{{unSubUrl}} - unsubscribe from all emails

Did this answer your question?