Sharing APIs
The Sharing SDK API lets you add social media sharing features to your games. With this API, you can let your players share their game moments, achievements, screenshots, and more with their friends and followers on social media platforms such as:
- Weibo (for users in China)
- Qzone (for users in China)
The API also creates a unique URL for each shared event that can be used to access the shared event on Microsoft Start Games. The URL link can be accessed and copied from the share dialog when the user clicks on the Copy Link button.
Usage
To invoke the share flow on Microsoft Start Games, simply call the $msstart.shareAsync
API and pass a shareData
object as an argument.
$msstart.shareAsync(shareData).then(response => {
// response will be a unique string id for the shared event.
});
The API returns a promise that resolves with a string id that is a unique identifier for the shared event. This id will also be available in $msstart.shareId
when other players access Microsoft Start Games from the shared post or URL.
The shareData
object has the type ShareGameData
, which has these properties:
{
title?: string,
text?: string,
image?: string,
}
As you can see in the type definition of
ShareGameData
, all properties are optional. However, you need to provide at least one of them to pass it and call the$msstart.shareAsync
API. Otherwise, the API will throw an exception.The image property can accept either an image URL or a base64-encoded image as a string value.