GS2-Inbox Transaction Actions

Specification of verify/consume/acquire transaction actions

ConsumeAction

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.

Whether the action allows quantity specification: NO

Whether the action is reversible: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Set #{userId} to replace the currently logged in user ID.
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetTokenstring~ 1024 charsTime 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.

Whether the action allows quantity specification: NO

Whether the action is reversible: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Set #{userId} to replace the currently logged in user ID.
messageNamestring
UUID~ 36 charsMessage Name
Maintains a unique name for each message.
Names are automatically generated in UUID (Universally Unique Identifier) format and used to identify each message.
timeOffsetTokenstring~ 1024 charsTime 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",
})

AcquireAction

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).

Whether the action allows quantity specification: NO

Whether the action is reversible: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Set #{userId} to replace the currently logged in user ID.
metadatastring
~ 4096 charsMetadata
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.
readAcquireActionsList<AcquireAction>[]0 ~ 100 itemsRead Acquire Actions
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.
expiresAtlongDatetime of ttl
Unix time, milliseconds
expiresTimeSpanTimeSpanThe period from the time a message was received (reference time) until it was deleted
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2Inbox:SendMessageByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "metadata": "[string]Metadata",
        "readAcquireActions": [
            {
                "action": "[string]Type of action to be executed in the Acquire Action",
                "request": "[string]JSON string of the request used when executing the action"
            }
        ],
        "expiresAt": "[long]Datetime of ttl",
        "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 action to be executed in the Acquire Action"
      request: "[string]JSON string of the request used when executing the action"
  expiresAt: "[long]Datetime of ttl"
  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 action to be executed in the Acquire Action",
            request="[string]JSON string of the request used when executing the action"
        }
    },
    expiresAt="[long]Datetime of ttl",
    expiresTimeSpan={
        days="[int]Days",
        hours="[int]Hours",
        minutes="[int]Minutes"
    },
    timeOffsetToken="[string]Time offset token",
})