Skip to main content
POST
/
channel
curl -X POST "http://localhost:5001/channel" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "group123",
    "channel_type": 2,
    "large": 0,
    "ban": 0,
    "subscribers": ["user1", "user2", "user3"]
  }'
{
  "status": "ok"
}

Overview

Create new chat channels, supporting both personal and group channel creation.

Request Body

Required Parameters

channel_id
string
required
Channel ID, must be unique
channel_type
integer
required
Channel type
  • 1 - Personal channel
  • 2 - Group channel

Optional Parameters

ban
integer
default:0
Whether to mute
  • 0 - Allow speaking
  • 1 - Mute all members
disband
integer
default:0
Whether to disband channel
  • 1 - Disband channel (irreversible)
send_ban
integer
default:0
Whether to prohibit sending messages (0=not prohibited, 1=prohibited). When prohibited, all members in the channel cannot send messages. Personal channels can receive messages but cannot send messages.
allow_stranger
integer
default:0
Whether to allow strangers to send messages (0=not allowed, 1=allowed) (this configuration currently only supports personal channels) Personal channel: If AllowStranger is 1, strangers can send messages to the current user. For example: if the current account needs to accept stranger messages, channel_id is the current user’s uid
subscribers
array
Subscriber list
subscribers[]
string
Subscriber user ID
curl -X POST "http://localhost:5001/channel" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "group123",
    "channel_type": 2,
    "large": 0,
    "ban": 0,
    "subscribers": ["user1", "user2", "user3"]
  }'
{
  "status": "ok"
}

Response Fields

status
string
required
Operation status, returns "ok" on success

Status Codes

Status CodeDescription
200Channel created successfully
400Request parameter error
409Channel ID already exists
500Internal server error

Best Practices

  1. Channel ID Uniqueness: Ensure channel ID is unique in the system
  2. Member Management: Properly set initial subscriber list
  3. Permission Control: Set mute status as needed