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"]
}'
const response = await fetch('http://localhost:5001/channel', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
large: 0,
ban: 0,
subscribers: ['user1', 'user2', 'user3']
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"large": 0,
"ban": 0,
"subscribers": ["user1", "user2", "user3"]
}
response = requests.post('http://localhost:5001/channel', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"large": 0,
"ban": 0,
"subscribers": []string{"user1", "user2", "user3"},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
Channel Management
Create Channel
Create new chat channels
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"]
}'
const response = await fetch('http://localhost:5001/channel', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
large: 0,
ban: 0,
subscribers: ['user1', 'user2', 'user3']
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"large": 0,
"ban": 0,
"subscribers": ["user1", "user2", "user3"]
}
response = requests.post('http://localhost:5001/channel', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"large": 0,
"ban": 0,
"subscribers": []string{"user1", "user2", "user3"},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
Overview
Create new chat channels, supporting both personal and group channel creation.Request Body
Required Parameters
string
required
Channel ID, must be unique
integer
required
Channel type
1- Personal channel2- Group channel
Optional Parameters
integer
default:0
Whether to mute
0- Allow speaking1- Mute all members
integer
default:0
Whether to disband channel
1- Disband channel (irreversible)
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.
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
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"]
}'
const response = await fetch('http://localhost:5001/channel', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
large: 0,
ban: 0,
subscribers: ['user1', 'user2', 'user3']
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"large": 0,
"ban": 0,
"subscribers": ["user1", "user2", "user3"]
}
response = requests.post('http://localhost:5001/channel', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"large": 0,
"ban": 0,
"subscribers": []string{"user1", "user2", "user3"},
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
Response Fields
string
required
Operation status, returns
"ok" on successStatus Codes
| Status Code | Description |
|---|---|
| 200 | Channel created successfully |
| 400 | Request parameter error |
| 409 | Channel ID already exists |
| 500 | Internal server error |
Best Practices
- Channel ID Uniqueness: Ensure channel ID is unique in the system
- Member Management: Properly set initial subscriber list
- Permission Control: Set mute status as needed

