In this topic we are going to cover some of the options these alternative platforms offer related to email features.

GameSparks does not have its own email service but instead integrates the SendGrid API through the Spark.sendGrid() API. SendGrid is a very lightweight service to integrate, so in most cases it can be integrated via C#, JS, etc. You can also integrate it in the client if there is no alternative option for these alternative platforms. However, that would be very insecure as it would mean exposing your API credentials after which anyone could use them.

If the alternative platform does not have a Cloud-Code feature you could protect your credentials by sending the request to an AWS Lambda function first, and then to the SendGrid API.

In some cases, these alternative platforms also have their own email features which can be used for registration emails and password reset, so we will mention those here too.


While Beamable does have a Mail Service, it is not the same as GameSparks’ SendGrid API and is instead used for in-game mail, specifically player inbox and that sort of thing. You can see more about their Mail Service here.

In this section we will show you how to keep your existing SendGrid implementation and rebuild the SendGrid API in Beamable.

SendGrid API

If you wish to continue using your existing SendGrid account with Beamable, you can integrate the SendGrid API into a Microservice. You can check out our guide here for more information on how to create and use Microservices, we will only cover the basics here.

Setup & Preparation

Before you can integrate the SendGrid code you will need to make sure you have an APIKey setup in SendGrid. We won't cover that here, but if you are already registered on SendGrid there are very good tutorials on the flow when you set up a new API key. In fact, they even show example code of how to integrate SendGrid in a number of programming languages, which is what we are going to get working in our Microservice using Beamable.

However, these examples use the NuGet package for SendGrid and C# which can be tricky to get working with Unity correctly. We suggest getting the NuGet package manager plugin for Unity available here.

Once the package manager is installed you can search for SendGrid in the manager. Select the top one from the list and install it, this can take a while.

Once you have the Sengrid package installed you can use it with your new Microservice. Add it as an assembly reference with your Microservice.

Now we can add our code to the Microservice function call. It's pretty much the same as the example you would have gotten from setting up your API key in your SendGrid account.

  private string sendGridAPIKey = "<api-key>";

  public async void SendEmail(string email)
     var client = new SendGridClient(sendGridAPIKey);
     var from = new EmailAddress("<your-company-email>", "<your-name>");
     var subject = "Sending with SendGrid is Fun";
     var to = new EmailAddress("<recipient-email>", "Example User");
     var plainTextContent = "and easy to do anywhere, even with C#";
     var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>";

     // Create the Email //
     var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
     // Send Email //
     var response = await client.SendEmailAsync(msg);
     // Check Response //
     var body = await response.Body.ReadAsStringAsync();

And that's it! You can then send an email out by calling the SendEmail request from the client.


AccelByte does not have an integration with SendGrid directly, however, it does come with some of the common functionality GameSparks developers use SendGrid for such as registration emails and password reset, so we will cover those features here.

New players on AccelByte are always sent a welcome email if they are registered through the normal username & password registration flow.

From there, if your player wishes to reset their password there are two APIs they need to call in order:

  1. Request Reset Password Code
  2. Use code, along with the new password to reset the user’s password.

Through the Unity SDK, this is very simple.

//Request reset password code
abUser.SendResetPasswordCode("username", OnResetCode);

public void OnResetCode(Result result)
  // password reset code returned //
//Reset Password
abUser.ResetPassword("code", "username", newPassword, OnResetPassword);

public void OnResetPassword(Result result)
  // password reset //

You can also achieve this through the REST API if you need to create your own flow or host your own reset web-pages or forms.

  1. Request Code
  2. Reset Password

SendGrid API

Because AccelByte does not have any direct integration with SendGrid like GameSparks does, in order to transition your current SendGrid functionality you will need to integrate their API into another application. SendGrid do have a C# SDK which you can see an example of in the Beamable section of the Emails topic, however, this is not advised as it would expose your apiKey. If the client was hacked, anyone could use your apiKey for their own applications.

There are a number of alternatives to sticking the SDK in the client.

Custom Microservice

AccelByte provides services for building custom microservices to meet your requirements. There is more about this in the Cloud-Code topic here. This microservice would be deployed alongside your environment so you have access through the SDK.

Custom Game-Server

In a case where you need more flexibility but do not want a custom microservice, you can create your own game-server and implement the SendGrid SDK into that.

Lambda & API Gateway

AWS Lambda and API Gateway are AWS serverless services. Lambdas allow you to run your scripts in the cloud which would be easily achieved with SendGrid’s JS SDK. API Gateway allows you to connect the execution of this script to a REST API, which would allow you to send messages from the client if needed, but your apiKey would not be exposed to the client.


While Nakama does not list SendGrid on their feature list you can easily get the SendGrid API working on Nakama using the HTTPRequest API due to the flexibility of the runtime servers. Nakama has a complete example of the SendGrid API working on their platform here.


brainCloud provides a SendGrid integration for sending emails.

To utilize brainCloud’s SendGrid functionality, simply: