GS2-Inbox Transaction Actions

Specification of verify/consume/acquire transaction actions

Consume Action

Gs2Inbox:OpenMessageByUserId

Marking messages as opened by specifying a user ID

Marks the specified message as read (opened) in the specified user’s inbox. This is a simple state transition that sets isRead to true without executing any acquire actions. To mark as read and also execute associated rewards, use the Read API instead.

Supports quantity specification: NO

Whether the action is reversible: NO

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userId string
~ 128 chars User ID
Specify #{userId} to substitute the currently logged-in user’s ID.
messageName string
UUID ~ 36 chars Message Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetToken string ~ 1024 chars Time offset token
{
    "action": "Gs2Inbox:OpenMessageByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "messageName": "[string]Message Name",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Inbox:OpenMessageByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  messageName: "[string]Message Name"
  timeOffsetToken: "[string]Time offset token"
transaction.service("inbox").consume.open_message_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    messageName="[string]Message Name",
    timeOffsetToken="[string]Time offset token",
})

Gs2Inbox:DeleteMessageByUserId

Delete message by specifying a user ID

Permanently removes a message from the specified user’s inbox. The message record is deleted regardless of its read status.

Supports quantity specification: NO

Whether the action is reversible: NO

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userId string
~ 128 chars User ID
Specify #{userId} to substitute the currently logged-in user’s ID.
messageName string
UUID ~ 36 chars Message Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetToken string ~ 1024 chars Time offset token
{
    "action": "Gs2Inbox:DeleteMessageByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "messageName": "[string]Message Name",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Inbox:DeleteMessageByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  messageName: "[string]Message Name"
  timeOffsetToken: "[string]Time offset token"
transaction.service("inbox").consume.delete_message_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    messageName="[string]Message Name",
    timeOffsetToken="[string]Time offset token",
})

Acquire Action

Gs2Inbox:SendMessageByUserId

Send a message by specifying a user ID

Creates and delivers a new message to the specified user’s inbox. The message can include metadata (arbitrary JSON content) and readAcquireActions (rewards granted when the message is read). Message expiration can be set using either an absolute timestamp (expiresAt) or a relative duration (expiresTimeSpan) from the time of delivery. If expiresAt is specified, it takes priority over expiresTimeSpan. The message starts in an unread state (isRead=false).

Supports quantity specification: NO

Whether the action is reversible: NO

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userId string
~ 128 chars User ID
Specify #{userId} to substitute the currently logged-in user’s ID.
metadata string
~ 4096 chars Metadata
Arbitrary data representing the message content, such as a JSON string containing the message title, body text, sender information, and display parameters. GS2 does not interpret this value; it is passed through to the game client for rendering the message UI. Maximum 4096 characters.
readAcquireActions List<AcquireAction> [] 0 ~ 100 items Acquire Actions on Open
The list of acquire actions executed when the user opens this message. Used to attach rewards such as items, currency, or resources to messages. Multiple actions can be combined to grant different reward types simultaneously. Up to 100 actions per message.
expiresAt long Expiration datetime
Unix time, milliseconds
expiresTimeSpan TimeSpan The period from the time a message was received (reference time) until it was deleted
timeOffsetToken string ~ 1024 chars Time offset token
{
    "action": "Gs2Inbox:SendMessageByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "metadata": "[string]Metadata",
        "readAcquireActions": [
            {
                "action": "[string]Type of Acquire Action",
                "request": "[string]JSON string of the request used when executing the action"
            }
        ],
        "expiresAt": "[long]Expiration datetime",
        "expiresTimeSpan": {
            "days": "[int]Days",
            "hours": "[int]Hours",
            "minutes": "[int]Minutes"
        },
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2Inbox:SendMessageByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  metadata: "[string]Metadata"
  readAcquireActions: 
    - action: "[string]Type of Acquire Action"
      request: "[string]JSON string of the request used when executing the action"
  expiresAt: "[long]Expiration datetime"
  expiresTimeSpan: 
    days: "[int]Days"
    hours: "[int]Hours"
    minutes: "[int]Minutes"
  timeOffsetToken: "[string]Time offset token"
transaction.service("inbox").acquire.send_message_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    metadata="[string]Metadata",
    readAcquireActions={
        {
            action="[string]Type of Acquire Action",
            request="[string]JSON string of the request used when executing the action"
        }
    },
    expiresAt="[long]Expiration datetime",
    expiresTimeSpan={
        days="[int]Days",
        hours="[int]Hours",
        minutes="[int]Minutes"
    },
    timeOffsetToken="[string]Time offset token",
})