Calls / Unity
Calls Unity v1
Calls Unity
Calls
Unity
Home
/
Calls
/
Unity
/
Group call

Manage custom items

You can store additional information associated with a room as key-value pairs in a room object. Custom key-value items are saved as an object and can be updated or deleted as long as the room status remains Open. You can add information related to customer service, refund, or inquiry as custom items to improve user experience.


Add custom items

After a room has been created, users can add custom items to roomParams as an object. By default, customItems is an empty object.

var customItems = new Dictionary<string, string> { { "key1", "value1" } };
var roomParams = new SbRoomParams { CustomItems = customItems };
SendbirdCall.CreateRoom(roomParams, (room, error) => { });

Update and delete custom items

You can update or delete custom items that are added to a room. To update a custom item, call the room.UpdateCustomItems() method. A new item with a new key will be added to the list of custom items. If a newly created custom item has the same key as the existing custom item, the value of the new item will replace the value of the existing item.

You can delete custom items by passing the list of keys to the existing custom items as a parameter to the room.DeleteCustomItems() method.

var items = new Dictionary<string, string> { { "key1", "value3" } };
room.UpdateCustomItems(items, (customItems, updatedKeys, error) =>
{
   // Custom items with matching keys in updatedKeys have been updated in the customItems.
});

var keys = new List<string> { "key1" };
room.DeleteCustomItems(keys, (customItems, deletedKeys, error) =>
{
   // Custom items with matching keys in deletedKeys have been deleted from customItems.
});