> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Inbox Script Trigger Reference

Reference for event triggers that call extended scripts



## Trigger

### receiveMessage

Message reception

**Related methods:**
sendMessageByUserId - Send a message by User ID
receiveGlobalMessage - Receive Unreceived Global Messages
receiveGlobalMessageByUserId - Receive Unreceived Global Messages by User ID


#### Synchronous Execution Script

The script is executed synchronously before the message reception process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| message | [Message](../sdk/#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


**Lua**
```lua

-- 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](../sdk/#namespace) | Namespace |
| message | [Message](../sdk/#message) | Message |


##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local message = args.message

-- Asynchronous scripts typically do not affect the API response.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  
### readMessage

Message opening

**Related methods:**
readMessage - Read message


#### Synchronous Execution Script

The script is executed synchronously before the message opening process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| message | [Message](../sdk/#message) | Message |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | Whether to allow message opening |

##### Implementation Example


**Lua**
```lua

-- 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](../sdk/#namespace) | Namespace |
| message | [Message](../sdk/#message) | Message |


##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local message = args.message

-- Asynchronous scripts typically do not affect the API response.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  
### deleteMessage

Deleting a message

**Related methods:**
deleteMessage - Delete message


#### Synchronous Execution Script

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

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| message | [Message](../sdk/#message) | Message |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | Whether to allow deleting a message |

##### Implementation Example


**Lua**
```lua

-- 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](../sdk/#namespace) | Namespace |
| message | [Message](../sdk/#message) | Message |


##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local message = args.message

-- Asynchronous scripts typically do not affect the API response.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  



