Manage Groups
Update Group
POST /conversations/:id
Updating here is mainly about group chats, such as updating group announcements, joining groups, exiting, muting, and other operations.
After the following operations are successful, complete conversation data will be returned, including group members.
Endpoint URL
https://api.mixin.one/conversations/:id
Payload
{
"name": "New group name, 512 characters at most.",
"announcement": "Group Announcements, 1024 characters at most.",
}
Every time the field is updated, all group members can see an eye-catching group announcement reminder bar.
Example request
curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/conversations/928c5c40-769c-3e97-8387-fb1ae0645311 --data PAYLOAD
{
"data": {
"type": "conversation",
"conversation_id": "928c5c40-769c-3e97-8387-fb1ae0645311",
"creator_id": "8dcf823d-9eb3-4da2-8734-f0aad50c0da6",
"category": "GROUP",
"name": "",
"icon_url": "",
"announcement": "",
"created_at": "2018-05-16T12:34:44.134238105Z",
"code_id": "d8244b92-30e9-44b5-bfb0-ce597c788125",
"code_url": "https://mixin.one/codes/d8244b92-30e9-44b5-bfb0-ce597c788125",
"mute_until": "2018-05-16T12:34:44.143010035Z",
"participants": [
{
"type": "participant",
"user_id": "8dcf823d-9eb3-4da2-8734-f0aad50c0da6",
"role": "OWNER",
"created_at": "2018-05-16T12:34:44.134238105Z"
},
{
"type": "participant",
"user_id": "e8e5b807-fa8b-455a-8dfa-b189d28310ff",
"role": "",
"created_at": "2018-05-16T12:34:44.149277666Z"
},
...
],
"participant_sessions": [
{
"user_id": "8dcf823d-9eb3-4da2-8734-f0aad50c0da6",
"session_id": "8dcf823d-9eb3-4da2-8734-f0aad50c0da6",
},
...
],
"circles": [
{
"circle_id": "8dcf823d-9eb3-4da2-8734-f0aad50c0da6",
"conversation_id": "8dcf823d-9eb3-4da2-8734-f0aad50c0da6",
"user_id": "8dcf823d-9eb3-4da2-8734-f0aad50c0da6",
"created_at": "2018-05-16T12:34:44.149277666Z"
},
...
]
}
}
Manage Group Member
POST /conversations/:code_id/join
Join the group via link. The code_id
is an ID to join the current group, which is returned by GET /conversation/:id
and generated by POST /conversations/:id/rotate
.
POST /conversations/:id/participants/ADD
If you are the owner or admin of this group conversation, you can add other users to the group by calling this API.
the payload:
[
{ "user_id": "" },
...
]
POST /conversations/:id/participants/REMOVE
If you are the owner or admin of this group conversation, you can remove a member from the group.
the payload:
[
{ "user_id": "" },
...
]
POST /conversations/:id/rotate
Reset invitation link and code_id
.
POST /conversations/:id/exit
Leave the current group.
Manage Administrators
Only the owners can set or cancel administrators
POST /conversations/:id/participants/ROLE
Set or revoke admin privileges for a user.
The request body of setting admin privileges:
[{ "user_id": "", "role": "ADMIN" }]
The request body of remove admin privileges:
[{ "user_id": "", "role": "" }]
Mute Group
Muted conversations will still receive messages, but without notifications.
POST /conversations/:id/mute
Request body data:
Parameter | Type | Description |
---|---|---|
duration | Int64 | In seconds, setting to 0 means unmute, other values means mute time, for example, setting 28,800 means mute 8 hours |
Before mute a group or user, the conversation should be created first, otherwise 403 error will be returned.
POST /conversations/:id/disappear
Request body data:
Parameter | Type | Description |
---|---|---|
duration | Int64 | In seconds, maximum 12 weeks |
Disappearing message, can be set by managers only.
Rules, take 30s as an example:
- If the message has been read, it would be deleted in 30s.
- If the message is never read, it would be deleted in 24h + 30s.