Set auto-destroy type
Set the auto-destroy type for an open channel. Before making changes, make sure you understand the auto-destroy mechanism.
- Destroy on inactivity (
destroyType: 0) — UsettlMinutesto set the inactivity duration (in minutes). The open channel is destroyed after being inactive (no joins/leaves and no new messages) for this duration. - Destroy on schedule (
destroyType: 1) — UsettlMinutesto set the time-to-live (in minutes), always counted from creation time. Maximum: 10,080 minutes (7 days).
danger
If an open channel currently uses scheduled destroy, the server still tracks its accumulated inactivity time. Switching the destroy type to destroy on inactivity may cause immediate destruction if the channel has been inactive for a long time.
Request
POST: https://[Base URL](/platform-chat-api/base-url)/v4/open-channel/destroy-type/set
Rate limit: 100 per second
Signature: Required. See API request signature.
Request body
Content type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | String | Yes | The open channel ID. |
destroyType | Number | No | Auto-destroy type. - 0: Destroy on inactivity (default). Destroyed after 60 minutes of inactivity. Adjust with ttlMinutes.- 1: Destroy on schedule. Destroyed 60 minutes after creation. Adjust with ttlMinutes. |
ttlMinutes | Number | No | Time condition for auto-destroy, in minutes. - When destroyType is 0: inactivity duration.- When destroyType is 1: time-to-live from creation.Range: 60–10,080 (7 days). Default: 60. |
Request example
HTTP
POST /v4/open-channel/destroy-type/set HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"channelId": "gid1",
"destroyType": 0,
"ttlMinutes": 120
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Return code. 0 indicates success. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"code":0}