Send a message to all the players who are member of the given team

View interactive version here

Request Parameters

Parameter Required Type Description
message No string The message to send
ownerId No string The team owner to find, used in combination with teamType. If not supplied the current players id will be used
teamId No string The teamId to find (may be null if teamType supplied)
teamType No string The teamType to find, used in combination with the current player, or the player defined by ownerId

Response Parameters

A response to a send team message request.

Parameter Type Description
scriptData ScriptData A JSON Map of any data added either to the Request or the Response by your Cloud Code

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.

Error Codes

Key Value Description
team INVALID No team exists for the given details
team NOT_A_MEMBER The current player is not a member of the team they are trying to message
authentication NOTAUTHORIZED The player is not authorized to perform the request
teamId|teamType REQUIRED The teamId or teamType is required but not provided

Code Samples


    using GameSparks.Api;
    using GameSparks.Api.Requests;
    using GameSparks.Api.Responses;
    new SendTeamChatMessageRequest()
        .Send((response) => {
        GSData scriptData = response.ScriptData;

ActionScript 3

    import com.gamesparks.*;
    import com.gamesparks.api.requests.*;
    import com.gamesparks.api.responses.*;
    import com.gamesparks.api.types.*;

        .send(function(response:com.gamesparks.api.responses.SendTeamChatMessageResponse):void {
        var scriptData:ScriptData = response.getScriptData(); 


    #import "GS.h"
    #import "GSAPI.h"
    GSSendTeamChatMessageRequest* request = [[GSSendTeamChatMessageRequest alloc] init];
    [request setMessage:message;
    [request setOwnerId:ownerId;
    [request setTeamId:teamId;
    [request setTeamType:teamType;
    [request setCallback:^ (GSSendTeamChatMessageResponse* response) {
    NSDictionary* scriptData = [response getScriptData]; 
    [gs send:request];


    #include <GameSparks/generated/GSRequests.h>
    using namespace GameSparks::Core;
    using namespace GameSparks::Api::Responses;
    using namespace GameSparks::Api::Requests;

    void SendTeamChatMessageRequest_Response(GS& gsInstance, const SendTeamChatMessageResponse& response) {
    GSData scriptData = response.getScriptData(); 

    SendTeamChatMessageRequest request(gsInstance);


import com.gamesparks.sdk.api.autogen.GSRequestBuilder.SendTeamChatMessageRequest;
import com.gamesparks.sdk.api.autogen.GSResponseBuilder.SendTeamChatMessageResponse;
import com.gamesparks.sdk.api.autogen.GSTypes.*;
import com.gamesparks.sdk.api.GSEventListener;

    .send(new GSEventListener<SendTeamChatMessageResponse>() {
        public void onEvent(SendTeamChatMessageResponse response) {

Cloud Code

    var request = new SparkRequests.SendTeamChatMessageRequest();
    request.message = ...;
    request.ownerId = ...;
    request.teamId = ...;
    request.teamType = ...;
    var response = request.Send();

var scriptData = response.scriptData;