A message sent from a Cloud Code script to one or more players.

See the Spark.sendMessage function in the Cloud Code - Java Script API documentation.

View interactive version here

Request Parameters

Parameter Required Type Description
data No JSON JSON data sent from a Cloud Code script.
extCode No string The extension code used when creating this script message
messageId No string A unique identifier for this message.
notification No boolean Flag indicating whether this message could be sent as a push notification or not.
scriptData No ScriptData[] ScriptData is arbitrary data that can be stored in a message by a Cloud Code script.
subTitle No string A textual title for the message.
summary No string A textual summary describing the message's purpose.
title No string A textual title for the message.

Nested types


A collection of arbitrary data that can be added to a message via a Cloud Code script.

Parameter Type Description
myKey string An arbitrary data key
myValue JSON An arbitrary data value.

Code Samples


    ScriptMessage.Listener = (message) => {
    GSData data = message.Data;
    string extCode = message.ExtCode;
    string messageId = message.MessageId;
    bool? notification = message.Notification;
    GSEnumerable<GSData> scriptData = message.ScriptData;
    string subTitle = message.SubTitle;
    string summary = message.Summary;
    string title = message.Title;

ActionScript 3

        function (message:ScriptMessage):void {
        var data:Object = message.getData(); 
        var extCode:String = message.getExtCode(); 
        var messageId:String = message.getMessageId(); 
        var notification:Boolean = message.getNotification(); 
        var scriptData:Vector.<ScriptData> = message.getScriptData(); 
        var subTitle:String = message.getSubTitle(); 
        var summary:String = message.getSummary(); 
        var title:String = message.getTitle(); 


    [listener onGSScriptMessage:^(GSScriptMessage* message) {
    NSDictionary* data = [message getData]; 
    NSString* extCode = [message getExtCode]; 
    NSString* messageId = [message getMessageId]; 
    BOOL notification = [message getNotification]; 
    NSArray* scriptData = [message getScriptData]; 
    NSString* subTitle = [message getSubTitle]; 
    NSString* summary = [message getSummary]; 
    NSString* title = [message getTitle]; 


        new GSEventConsumer<ScriptMessage>() {
            public void onEvent(ScriptMessage message) {
        GSData data = message.getData(); 
        String extCode = message.getExtCode(); 
        String messageId = message.getMessageId(); 
        Boolean notification = message.getNotification(); 
        String subTitle = message.getSubTitle(); 
        String summary = message.getSummary(); 
        String title = message.getTitle(); 


    using namespace GameSparks::Core;
    using namespace GameSparks::Api::Messages;
    void OnScriptMessage(GS& gsInstance, const ScriptMessage& message)
    GSData data = message.getData(); 
    gsstl::string extCode = message.getExtCode(); 
    gsstl::string messageId = message.getMessageId(); 
    Optional::t_BoolOptional notification = message.getNotification(); 
    gsstl:vector<GSData> scriptData = message.getScriptData(); 
    gsstl::string subTitle = message.getSubTitle(); 
    gsstl::string summary = message.getSummary(); 
    gsstl::string title = message.getTitle();