Edit Conversation
Description
Section titled “Description”wss conversation_update
The conversation_update
request allows you to edit the specified fields in the chat object.
For type
g
, c
only owner/admin can update conversation. Request Parameters
Section titled “Request Parameters”Name | Type | Description |
---|---|---|
id | string | Conversation type |
name | string | Conversation name |
description | string | Description of conversation |
participants.add | array[string] | Array of participant IDs who need to be added |
participants.remove | array[string] | Array of participant IDs who need to be kicked |
admins.add | array[string] | Array of admin IDs who need to be added |
admins.remove | array[string] | Array of admin IDs who need to be kicked |
image_object.file_blur_hash | string | Blur hash for chat image |
image_object.file_name | string | Chat image name |
image_object.file_id | string | Chat image file id |
Response Fields
Section titled “Response Fields”Name | Type | Description |
---|---|---|
conversation | object | Updated Conversation object |
Example
Section titled “Example”{ "request": { "conversation_update": { "id": "currentConversationId", "name": "NewName", "description": "NewDescription", "participants": { "add": [ "63077ad836b78c3d82af0812", "63077ad836b78c3d82af0832" ], "remove": [ "63077ad836b78c3d82af0816" ], } "admins": { "add": ["63077ad836b78c3d82af0812"], "remove": ["63077ad836b78c3d82af0816"] } }, "id": "RequestId" }}
{ "response": { "id": "RequestId", "conversation": { ... } } }
Events
Section titled “Events”Adding a user
Section titled “Adding a user”After adding users to a conversation, if they are online, they will receive the following event about the newly created conversation:
{ "system_message": { "_id": "646e2092d80fe5c4e688dfa0", "t": 15673838833, "cid": "646e2092d80fe5c4e688dfa0", "from": "63077ad836b78c3d82af0812", "x": { "conversation_updated": { "_id": "646e2092d80fe5c4e688dfa0", "type": "u", "opponent_id": "646c823bf989c57fe910d289", "participants": ["646c823bf989c57fe910d289"], "owner_id": "646c82947b3aceab988c0073", "created_at": "2023-05-24T14:34:58.066Z", "updated_at": "2023-05-24T14:52:24.953Z" } } }}
The following message will also be sent to all users who are online and saved in the Message
collection:
{ "_id": "655b479fe980b3e36f402234", "body": "Sam Samuels has been added to the group", "cid": "646e2092d80fe5c4e688dfa0", "from": "646c82947b3aceab988c0073", "status": "sent", "t": 1700480927, "x": { "type": "added_participant", "user": { "_id": "64cb6b2def440b9c5bf18d6d", "login": "sam1991", "recent_activity": 1700149064, "first_name": "Sam", "last_name": "Samuelson", "email": "DonateforUkraine@gmail.com" } }, "created_at": "2023-05-24T14:34:58.066Z"}
Kicking a user
Section titled “Kicking a user”After kicking users out of the conversation, if they are online, they will receive the following event:
{ "system_message": { "_id": "646e2092d80fe5c4e688dfa0", "t": 15673838833, "cid": "646e2092d80fe5c4e688dfa0", "from": "63077ad836b78c3d82af0812", "x": { "conversation_kicked": { "_id": "646e2092d80fe5c4e688dfa0", "type": "u", "opponent_id": "646c823bf989c57fe910d289", "participants": ["646c823bf989c57fe910d289"], "owner_id": "646c82947b3aceab988c0073", "created_at": "2023-05-24T14:34:58.066Z", "updated_at": "2023-05-24T14:52:24.953Z" } } }}
The following message will also be sent to all users who are online and saved in the Message
collection:
{ "_id": "655b479fe980b3e36f402234", "body": "Lane Stark has been remove from the group", "cid": "646e2092d80fe5c4e688dfa0", "from": "646c82947b3aceab988c0073", "status": "sent", "t": 1700480927, "x": { "type": "removed_participant", "user": { "_id": "64cb6b2def440b9c5bf18d6d", "login": "lane1991", "recent_activity": 1700149064, "first_name": "Lane", "last_name": "Stark", "email": "DonateforUkraine@gmail.com" } }, "created_at": "2023-05-24T14:34:58.066Z"}
See Also
Section titled “See Also” SAMA chat server API: Conversations When we developed our API, we followed three rules: fast, confidential, and scalable. Each of these rules has a powerful force when we choose which messenger you will use.
DataBase Records Collection of complete objects stored in the database.