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
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| message | Message | Message |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow message reception | ||
| overrideMetadata | string | 0 ~ 4096 chars | Overwritten 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
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| message | Message | Message |
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
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| message | Message | Message |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | 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
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| message | Message | Message |
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
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| message | Message | Message |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | 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
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| message | Message | Message |
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 = {
}