Blog

Latest news and updates from the PlayFab developers

by TessMilom 2017-11-15

Announcing Email Messaging

We’re excited to announce email messaging, which introduces a flexible way to engage and communicate with your players. With email messaging, you can now send customized emails to players on a prearranged schedule, PlayStream event rule, or by calling an API. The content of the emails is fully customizable, with HTML templates which can include player profile properties. The emails are sent from your own email server, so details such as the “from” and “reply-to” fields are consistent with your brand.

Using email messaging, you can send an email to verify a user’s email address, reset their password, target a segment of lapsed players with a link to redeem a gift, or notify active players of an upcoming special event. These are just a few examples of addressing customer requests or stimulating player engagement.

As a complete roll-out, we’ve added Contact email fields, email templates, new PlayStream actions and events, new API calls, and support for SMTP servers.

Contact Email Fields

One core part of email messaging is the addition of a Contact email field to player profiles. You can now use the AddOrUpdateContactEmail API to populate the Contact email field in the player profile with the email address you will use to communicate with the player.

The game manager will associate Contact emails with one of three states; Pending, Unverified, and Verified. These labels are based on the state of email verifications; Unverified emails have not been sent an email verification, Pending emails have been sent an email verification, and Verified emails have clicked their verification link without error. You can view the Contact email information through GetPlayerProfile, or through the Game Manager UI.

SMTP Server Setup

With the addition of Contact emails, you can take advantage of email messaging to extend your reach to your player base and invent new ways to use or create in-game actions. The first step is to set up a secure SMTP server, so follow our SMTP Setup Tutorial for detailed instructions. With the support of your SMTP server, email templates empower game developers to define how, when, and where these messages interact with your game.

Email Templates

Different scenarios call for different responses, and email templates make it easy to personalize and deploy timely and relevant responses. PlayFab’s email templates make it a snap to handle common use cases, and the custom template can address many other types of scenarios. Each type is customizable so they can be adapted to countless scenarios.

One way to customize your email templates is to use template variables to inject relevant data into each message. For example, it would be in good form to include the variable $Profile.DisplayName$ to personalize each email to every recipient.

Email Verification Template Details

Game developers can use the Email Verification template to update a player’s contact email. This template works by sending a message containing the template variable “$ConfirmationUrl$”. This generates a link that, when clicked by the player, creates the event “auth_token_validated” to trigger an update to the player’s profile. Players are simultaneously redirected to a Callback URL, which can be a simple static page informing them that the intended action was successfully completed.

Account Recovery Template Details

The Account Recovery template requires the player be sent to a developer-hosted password recovery form with at least a password entry field so that API calls can then make the requested updates to the password in their profile.

Custom Template Details

The Custom template is more of a blank slate. You can use this template to send basic email messages to your players. Or you can alter certain elements of the Account Recovery or Email Verification templates to design Custom templates that perform similar functions to produce different results.

For example, you can email lapsed players with a link to redeem a gift. To do so, create a custom email template with the following text:  

<body><p>Hello, $Profile.DisplayName$, we noticed you haven’t played in a while and would love to see you back. We have <a href='$ConfirmationUrl$'>a special gift for you</a> too!</p>

Then, create a Scheduled Task to perform the Send Email action to the Lapsed Players segment, using the Custom template you created.

In the Account Recovery template, the Callback URL provides a form for a player to submit information so that developers can then make API calls based on that input. You could use alternative Callback URLs that make use of different API calls to prompt different kinds of player input. For example, this template could be used to send players to a survey and then reward them for completing it.

PlayFab’s email templates are designed to be flexible. If you apply PlayStream Rules and events strategically, the only real limitation is your imagination.

Send Email Action

We’ve added a new Action to work with this feature: Send Email. Game developers can use “Send Email” as an Action triggered by a Rule or as part of a Scheduled Task. In both cases, the Action will automatically send your chosen Email Template to the player’s contact email when it’s been triggered. One such use for setting Rules to trigger emails could be to notify players of important changes to their accounts; when they request a password reset, if they have made real money purchases, been banned, received an award, redeemed a coupon, and more.

New PlayStream Events

We’ve also provided more built-in PlayStream events to help you integrate email messaging into your game. Three new PlayStream events have been added:

  • auth_token_validated - Triggered when an email Confirmation URL is clicked.
  • sent_email - Triggered when an email is sent or fails to be sent to a contact email.
  • player_updated_contact_email - Triggered when a player updates the contact email in their profile.

You can use these new PlayStream events to trigger updates to the validation state of contact emails, or create more complex logic around them. As always, you can create custom PlayStream events with our Client API.

New APIs

At PlayFab, every significant feature release means new APIs, and this release comes with several:

We’ve shared a few of our ideas on how to use our new email templates in this blog post, but we’re even more excited to see what our developer community comes up with. We’d love for you to share the email templates and PlayStream Events that you create in our community forum. For further instruction, please check out our tutorials on Using a Rule to Verify a Contact Email Address and Setting Up Account Recovery Emails.