Skip to contentSkip to navigationSkip to topbar
On this page

Modifying a Conversation, Message, or Participant


You can modify certain objects in the Conversations SDK (i.e. Conversation, Message, Participant) for connected Users with appropriate permissions.


Updating

updating page anchor

You can update a Conversation object by calling one of the appropriate methods for your chosen language.

For the Conversation, Message, or Participant data object, you could update some specific properties. Please refer to Update a Conversation, Message or Participant code sample.

Update a Conversation, Message or ParticipantLink to code sample: Update a Conversation, Message or Participant
1
/* Updating Conversations/Messages/Participants */
2
3
/* Conversations */
4
5
await conversation.updateAttributes({});
6
await conversation.updateFriendlyName("foo");
7
await conversation.updateLastReadMessageIndex(0);
8
await conversation.updateUniqueName("foo");
9
10
/* Messages */
11
12
await message.updateAttributes([1, {foo: "bar"}]);
13
await message.updateBody("bar");
14
15
/* Participants */
16
17
await participant.updateAttributes({foo: 8});

You can delete a Conversation object by calling the appropriate method for your chosen language. When you remove a Conversation object, all its Messages, attached Media, and Participants will be deleted.

If you want to only delete a Message from a Conversation, call the specific method to remove it from the Conversation, and destroy any attached Media.

If you want to only delete a Participant from a Conversation, call the specific method to remove them from the Conversation.

Delete a Conversation, Message or ParticipantLink to code sample: Delete a Conversation, Message or Participant
1
/* Deleting and updating Conversations/Messages/Participants */
2
3
/* Conversations */
4
5
// destroys the conversation, with all its messages and attached media and removes all participants
6
await conversation.delete();
7
8
/* Messages */
9
10
// remove a message from the conversation, destroying any attached media
11
await message.remove();
12
13
/* Participants */
14
15
// remove participant from the conversation
16
await participant.remove();

Please note that when you delete a parent object, you will also delete its child object. For example, if you remove a Conversation, then all Messages and Participants will be automatically deleted. Once deleted, these resources are unrecoverable.

Check out our auto-generated documentation for more information about Conversations SDK methods and properties: JavaScript(link takes you to an external page), Android(link takes you to an external page) or iOS(link takes you to an external page).


Congratulations! 🎉 You've finished the getting started guides. Now, let's explore more Conversations SDK guides: