GS2-Inbox Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

receiveMessage

Message reception

Synchronous Execution Script

The script is executed synchronously before the message reception process.

Request
TypeDescription
namespaceNamespaceNamespace
messageMessageMessage
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow message reception
overrideMetadatastring0 ~ 4096 charsOverwritten metadata
Implementation Example
-- Request
local namespace = args.namespace
local message = args.message

-- Business logic:
local permit = true
local overrideMetadata = ""

-- Result
result = {
  permit=permit,
  overrideMetadata=overrideMetadata
}

Asynchronous Execution Script

The script is executed asynchronously after the message reception process.

Request
TypeDescription
namespaceNamespaceNamespace
messageMessageMessage
Implementation Example
-- Request
local namespace = args.namespace
local message = args.message

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

readMessage

Message opening

Synchronous Execution Script

The script is executed synchronously before the message opening process.

Request
TypeDescription
namespaceNamespaceNamespace
messageMessageMessage
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow message opening
Implementation Example
-- Request
local namespace = args.namespace
local message = args.message

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the message opening process.

Request
TypeDescription
namespaceNamespaceNamespace
messageMessageMessage
Implementation Example
-- Request
local namespace = args.namespace
local message = args.message

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

deleteMessage

Deleting a message

Synchronous Execution Script

The script is executed synchronously before the deleting a message process.

Request
TypeDescription
namespaceNamespaceNamespace
messageMessageMessage
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow deleting a message
Implementation Example
-- Request
local namespace = args.namespace
local message = args.message

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the deleting a message process.

Request
TypeDescription
namespaceNamespaceNamespace
messageMessageMessage
Implementation Example
-- Request
local namespace = args.namespace
local message = args.message

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}