Manage Tag Information Data
The SDK supports creating a tagging system for managing conversations. Tags created by the SDK will be synchronized to the server.
This document describes the SDK's tag management interfaces, including how to create, edit, retrieve, and remove tags.
tip
For details on how to use tags to manage conversations, refer to Using Tags to Manage Conversations.
Create a Tag
Call addTag to create a tag. Each user can create up to 20 tags.
RongIMLib.addTag({
tagId: '<TagId>',
tagName: '<TagName>'
}).then(({ code }) => {
console.log(code);
});
Parameter | Type | Required | Description |
---|---|---|---|
tag | ITagParam | Yes | The tag to be created |
tag.tagId | string | Yes | Tag ID, with a maximum length of 10 |
tag.tagName | string | Yes | Tag name, with a maximum length of 15 |
Remove a Tag
Call removeTag to delete a tag.
RongIMLib.removeTag('<TagId>').then(({code}) => {
console.log(code)
});
Parameter | Type | Required | Description |
---|---|---|---|
tagId | string | Yes | The ID of the tag to be removed |
Edit a Tag
Call updateTag to update a tag.
RongIMLib.updateTag({
tagId: '<TagId>',
tagName: '<NewTagName>'
}).then(({code}) => {
console.log(code)
});
Parameter | Type | Required | Description |
---|---|---|---|
tag | ITagParam | Yes | The tag to be edited |
tag.tagId | string | Yes | Tag ID, with a maximum length of 10 |
tag.tagName | string | Yes | Tag name, with a maximum length of 15 |
Get Tag List
Call getTags to retrieve the list of tags.
RongIMLib.getTags().then(({code, data}) => {
console.log(code, data)
});