Team Feature

Update time: 2021/12/14 08:30:36

Overview

The management class corresponding to team features is nim::Team. Two group chat features including normal group and advanced group are available. In the advanced group, members have more operation permissions. Two group chat features share the same interface when implementing the same operation. We recommend to develop applications based on one of the group chat feature. The normal group has the different group type from the advanced group. Under the current versions, the advanced group covers all features of the normal group. We recommend to develop applications by using the advanced group.

  • Normal group

Similar to a discussion team or quick group session in the current IM chat application, an ordinary team does not have full team privileges. Each ordinary team can only have one administrator. The administrator can add members to and remove members from a team. Members can add members without the consent of the team members.

  • Advanced group

Advanced team has more limitations on the permission which is granted to the owner, manager and team members. To add a new member, his/her acceptance of invitation is required. The information of advanced team members may be synced in real time, and the team switch setting field and third-party extension field (for storage and pass-through only) and the third-party server extension field (set only via the server interface, and read only to the client) are made available.

  • Comparison of team operation permissions
Team operation Normal team Advanced team
Invite member Anyone Team owner, manager
Kick out member Team owner Team owner, manager (a manager cannot kick any other manager out)
Dismiss team Team owner Team owner
Leave Anyone Manager, normal members
Process join application / Team owner, manager
Modify your own nickname in the team / Anyone
Modify others' nicknames in the team / Team owner, manager
Modify team name Anyone Team owner, manager
Modify team announcement / Team owner, manager
Modify team introduction / Team owner, manager
Update verification method / Team owner, manager
Add (remove) manager / Team owner
Change the team owner / Team owner
Mute or unmute one or more members / Team owner, manager
Update team avatar / Team owner, manager

NIMTeamTypeTeam type description

Team type Value Description
kNIMTeamTypeNormal 0 Normal team
kNIMTeamTypeAdvanced 1 Advanced team

NIMTeamUserTypeTeam type description

Team type Value Description
kNIMTeamUserTypeNomal 0 Normal members
kNIMTeamUserTypeCreator 1 Creator
kNIMTeamUserTypeManager 2 Manager
kNIMTeamUserTypeApply 3 Apply to add users
kNIMTeamUserTypeLocalWaitAccept 100 Local records are waiting for users joining the group

In addition to distinctive message types, group chat and double chat are the same in terms of sending, receiving and managing messages. See Message sending and receiving for details.

Team Notification Event

  • API introduction

Registering this event to monitor team information changes, including team creation, dismissal, joining invitation, kick-out, and other relevant operations, the caller will be notified through this event.

TeamEventCallbackParameter description

Type Parameter Description
TeamEvent TeamEvent Team notification content

TeamEventParameter description

Type Parameter Description
NIMResCode res_code_ Error code information, seeNIMResCodefor details
string team_id_ Team id
NIMNotificationId notification_id_ Team notification types, including team creation, dismissal, etc. (seeNIMNotificationId for details)
list ids_ IDs of team members that may be involved in the notification. For example, when adding multiple managers, ids in the received notification would correspond to multiple accounts.
list invalid_ids_ Invalid team member ids that may be involved in the notification, including those from joining invitations which have failed due to exceeding the max. number of members.
string Id id of a single member operation, such as that of a muted member or the original owner in a owner change operation.
NIMTeamInfo team_info_ Team information data
TeamMemberProperty member_property_ Team member information, such as using notification typekNIMNotificationIdTeamSyncUpdateMemberPropertyto notify self member attribute update
list namecards_ Namecards of team members that may be related to the notification
int opt_ Notification of muting, 1: mute 0: : Dismiss mute
string attach_ Extension field, current options only cover kick and invite events (not yet supported)

NIMNotificationIdEnumeration type description

Enumeration Value Description
kNIMNotificationIdTeamInvite 0 Add user to normal team , {"tinfo":team_info,"ids":["a1", "a2"],"uinfos":["uinfo1", "uinfo2"]}, json string corresponds to data ofNIMTeamEventfiled, same below
kNIMNotificationIdTeamKick 1 Remove user from normal team ,{"tinfo":tinfo,"ids":["a1", "a2"],"uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamLeave 2 Exit team, {"uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamUpdate 3 Update team information, {"tinfo":tinfo,"uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamDismiss 4 Dismiss team, {"uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamApplyPass 5 Team joining application accepted, {"tinfo":tinfo,"id":"a1","uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamOwnerTransfer 6 Advanced team owner changed, {"id":"a1","uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamAddManager 7 Add manager, {"ids":["a1","a2"],"uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamRemoveManager 8 Remove manager, {"ids":["a1","a2"],"uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamInviteAccept 9 Join advanced team by accepting invitation, {"tinfo":tinfo,"id":"a1","uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdTeamMuteMember 10 Mute/unmute team members, {"uinfos":["uinfo1", "uinfo2"],"tinfo":tinfo,"id":"a1","mute":1-mute,0-unban}
kNIMNotificationIdNetcallMiss 101 Missed call (not yet supported),{"calltype":1,"channel":6146078138783760761,"from":"id1","ids":["id1","id2"],"time":1430995380471}
kNIMNotificationIdNetcallBill 102 Call ticket (not yet supported),{"calltype":2,"channel":6146077129466446197,"duration":8,"ids":["id1","id2"],"time":1430995117398}
kNIMNotificationIdTeamSyncCreate 1000 Create team {"tinfo": tinfo}
kNIMNotificationIdTeamMemberChanged 1001 Team member changed {"team_member": team_member_info}
kNIMNotificationIdTeamSyncUpdateMemberProperty 1002 Synchronous notification: Update your own team attributes {"team_member": team_member_info} currently only kNIMTeamUserKeyNick and kNIMTeamUserKeyBits are required. When the notification is received,MemberInfofield will show the updated information
kNIMNotificationIdLocalCreateTeam 2000 Local operation to create group {"ids": ["a1", "a2"]}
kNIMNotificationIdLocalApplyTeam 2001 Local operation to apply for joining the team
kNIMNotificationIdLocalRejectApply 2002 Local operation to reject application {"id":"a1"}
kNIMNotificationIdLocalRejectInvite 2003 Local operation to decline invitation {"id":"a1"}
kNIMNotificationIdLocalUpdateMemberProperty 2004 Local operation to update team member attributes
kNIMNotificationIdLocalUpdateOtherNick 2005 Local operation to update others' nicknames
kNIMNotificationIdLocalGetTeamInfo 2006 Remove user from normal team ,{"tinfo":tinfo,"ids":["a1", "a2"],"uinfos":["uinfo1", "uinfo2"]}
kNIMNotificationIdLocalGetTeamList 2007 Local operation to get team member information
kNIMNotificationIdLocalMuteMember 2008 Local operation to mute team members
kNIMNotificationIdLocalNetcallReject 3103 Reject call (not yet supported),{"calltype":1,"channel":6146078138783760761,"from":"id1","ids":["id1","id2"],"time":1430995380471}
kNIMNotificationIdLocalNetcallNoResponse 3104 No answer, call not connected (not yet supported),{"calltype":1,"channel":6146078138783760761,"from":"id1","ids":["id1","id2"],"time ":1430995380471}
  • API prototype
static void RegTeamEventCb(const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
cb Asynchronous notification callback
json_extension Extension field. Reserved
  • Example
//Register event monitoring
nim::Team::RegTeamEventCb([&](const nim::TeamEvent& teamEvent)
{
    ...
});


//Unregister event monitoring when it is no longer needed
nim::Team::RegTeamEventCb(nullptr);

Get Team

Since NIM SDK will synchronize local team messages at the startup, a team may be fetched by calling the local cache interface. SDK provides massive team interfaces required to fetch it and the interfaces required for inquiry according to a team ID. SDK also provides the interfaces for remote access to team messages. ClassTeamInfo encapsulates team information.

TeamInfoParameter description

Type Parameter Description
string GetTeamID() Team id
string GetName() Team name
NIMTeamType GetType() Team type, advanced or normal, see NIMTeamType for details
string GetOwnerID() Owner or creator of the team
int GetLevel() Team level
string GetProperty() Extension field reserved for team attribute, the length of which is limited to 6000 characters
int IsValid() Whether this team is valid, 1 valid, 0 invalid
int GetMemberCount() Number of team members
int64_t GetMemberListTimetag() Timestamp of the latest update of the team member list (in milliseconds)
int64_t GetCreateTimetag() Team creation timestamp (in milliseconds)
int64_t GetUpdateTimetag() Timestamp of the latest update of team information (in milliseconds)
bool IsMemberValid() Whether the member list of the team is still valid, 1: valid 0: invalid
string GetIntro() Team introduction
string GetAnnouncement() Team announcement
NIMTeamJoinMode GetJoinMode() Team joining mode, 0-verification not required 1-verification required 2-no joining allowed (only for advanced team)
string GetCustom() Third-party extension field, only for storage and transparent transmission
string GetServerCustom() Server reserved extension field (this configuration item can only be set by using server interface, it is read-only for the client) (only for advanced team)
string GetIcon() Team avatar
NIMTeamBeInviteMode GetBeInvitedMode() Whether the invitee's consent is required, an attribute that can only be updated by the owner and manager, 0-consent required (default), 1- consent not required (only for advanced team).
NIMTeamInviteMode GetInvitedMode() Who can invite others to join the team,an attribute that can only be updated by the owner and manager, 0-administrator (default), 1-everyone (only for advanced team).
NIMTeamUpdateInfoMode GetUpdateMode() Who can update team information,an attribute that can only be updated by the owner and manager, 0-administrator (default), 1-everyone (only for advanced team).
NIMTeamUpdateCustomMode GetUpdateCustomMode() Who can update custom team attribute, an attribute that can only be updated by the owner and manager (only for advanced team).
bool IsAllMemberMute() Tag for muting all team members 0: not mute all, 1: mute all(only for advanced team) (not supported now)

Note: When the user leaves or is kicked out of the team or the team is dismissed, the value of IsMemberValid() is false, meaning that for that user, this team is no longer a valid team.

TeamMemberPropertyParameter description

Type Parameter Description
string GetTeamId() Team id
string GeAccountId() Team member account
NIMTeamUserType GeUserType() Team member type, see NIMTeamUserType for details
int64_t CreatedTimetag() Team joining timestamp
int64_t UpdatedTimetag() Timestamp of team member information update
bool IsValid() Whether the team member is valid or not, should be false if the member has left the team
string GetNick() Team member nickname
int64_t GetBits() Configuration attribute, currently only used to set message reminder, 1: reminder on, the default is 0
string GeCustom() Custom third-party extension information
bool IsMute() Whether to mute, true: mute, false: unmute (default)

Get Local Team List

In the latest version of SDK, when the user is no longer in the team or the group has been dismissed, the corresponding cached data in local database will no longer be cleared, and as a result interfaces for querying valid teams and all teams (including invalid teams) are both provided.

1. Get the list of valid team information

  • API prototype
 static void QueryAllMyTeamsInfoAsync(const QueryAllMyTeamsInfoCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
cb Notification result callback
json_extension Extension field, optional, used to include invalid teams in the query, format example: {"include_invalid":1}, the default is querying only valid teams
  • Example

//Get team information list
nim::Team::QueryAllMyTeamsInfoAsync([&](int count, const std::list<nim::TeamInfo>& list) 
{
    ...
});

//Get all team information lists, including those of invalid teams
Json::Value param;
param["include_invalid"] = true;
nim::Team::QueryAllMyTeamsInfoAsync([&](int count, const std::list<nim::TeamInfo>& list) 
{
    ...
},param.toStyledString());

2. Get the list of teams you've joined

  • API introduction

Team id list that covers only teams you've joined

  • API prototype
 static void QueryAllMyTeamsAsync(const QueryAllMyTeamsCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Get the id list of teams you joined
nim::Team::QueryAllMyTeamsAsync([&](int team_count, const std::list<std::string>& result) 
{
   
});

Get Team Information

The SDK supports getting local team information synchronously or asynchronously, and also provides an interface for directly getting group information from the cloud.

1. Get local team information (synchronously)

  • API prototype
 static TeamInfo QueryTeamInfoBlock(const std::string& tid);

  • Parameter Description
Parameter Description
tid Team ids to be obtained
  • Example
//Get local team information
std::string tid = "1243354";
TeamInfo tinfo = nim::Team::QueryTeamInfoBlock(tid);

2. Get local team information (asynchronously)

  • API prototype
 static bool QueryTeamInfoAsync(const std::string& tid, const QueryTeamInfoCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ids to be obtained
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Get local team information
std::string tid = "1243354";
nim::Team::QueryTeamInfoAsync(tid, [&](const std::string& tid, const nim::TeamInfo& info) 
{
    ...
});

3. Get team information from the cloud

  • API prototype
static bool QueryTeamInfoOnlineAsync(const std::string& tid, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ids to be obtained
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Get team information from the cloud
std::string tid = "1243354";
nim::Team::QueryTeamInfoOnlineAsync(tid, [&](const nim::TeamEvent& teamEvent) 
{
    ...
});

Get Mute List from the Cloud

  • API prototype
 static bool QueryMuteListOnlineAsync(const std::string& tid, const QueryTeamMembersOnlineCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ids to be obtained
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Get mute list from the cloud
std::string tid = "1243354";
nim::Team::QueryMuteListOnlineAsync(tid, [&](nim::NIMResCode ret, const std::string& tid, const std::list<nim::TeamMemberProperty>& list)
{
    ...
});

Team Member Information

The SDK supports getting team member list information, or only the information of a single team member. To facilitate calling by developers, two interfaces are provided for getting the information of a single team member, one is the synchronous version, the other is the asynchronous version.

Get Team Member List

The list obtained by this feature covers valid members of a specified team and also local members who have left the team.

  • API prototype
static bool QueryTeamMembersAsync(const std::string& tid, const QueryTeamMembersCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ids to be obtained
cb Notification result callback
json_extension Extension field, optional, used to include invalid team members in the query, format example: {"include_invalid":1}, the default is querying only valid teams
  • Example
//Get member information of valid teams
std::string tid = "1243354";
nim::Team::QueryTeamMembersAsync(tid,[this](const std::string& tid, int count, const std::list<nim::TeamMemberProperty>& list)
{
    ...
});

//Get all team member lists, including those of invalid teams
Json::Value param;
param["include_invalid"] = true;
nim::Team::QueryTeamMembersAsync(tid,[this](const std::string& tid, int count, const std::list<nim::TeamMemberProperty>& list)
{
    ...
},param.toStyledString());

Get Team Member Information

1. Get team member information (synchronously)

  • API prototype
 static TeamMemberProperty QueryTeamMemberBlock(const std::string& tid, const std::string& id);

  • Parameter Description
Parameter Description
tid Team ids to be obtained
id Team member ids to be obtained
  • Example
//Get information of team member test1
std::string tid = "1243354";
std::string uid = "test1";
NIMTeamMemberInfo tinfo = nim::Team::QueryTeamMemberBlock(tid,uid);

2. Get team member information (asynchronously)

  • API prototype
static bool QueryTeamMemberAsync(const std::string& tid, const std::string& id, const QueryTeamMemberCallback& cb,const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ids to be obtained
id Team member ids to be obtained
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Get information of team member test1
std::string tid = "1243354";
std::string uid = "test1";
nim::Team::QueryTeamMemberAsync(tid,uid,[&](const nim::TeamMemberProperty& member)
{
   ...
});

Create A Team

Created teams include normal and advanced teams. In the current version of the SDK, advanced team has all the features of normal team . TeamInfo contains the detailed information of the team. By setting this object, you can specify the team type, team permissions, team information etc.; and once invitation_postscriptis set, it will be sent to every member in the team.

  • API prototype
 static bool CreateTeamAsync(const TeamInfo& team_info, const std::list<std::string>& ids, const std::string& invitation_postscript	, const TeamEventCallback& cb, const std::string& json_extension = "");


  • Parameter Description
Parameter Description
team_info Basic information of the created team, including team name, team announcement, etc.
ids When creating a team, you need to add user accounts of the team (excluding your own account), and an invitation will be sent to each account in theidsautomatically.
invitation_postscript Invitation postscript information
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//For example, for test accounts test1, test2

TeamInfo ti;
ti.SetName("teamName");
ti.SetAnnouncement("team announcement");
ti.SetIntro("team introduction");
ti.SetType(kNIMTeamTypeAdvanced);

std::list<std::string> members;
members.push_back("test1");
members.push_back("test2");

nim::Team::CreateTeamAsync(ti, members, "invitation postscript information", [&](const nim::TeamEvent& teamEvent) 
{
    ...
});

Join Team

Users can join a team actively or passively by accepting invitations.

Invite Users to Team

  • API introduction

After the request, the invitee of a normal team will directly join the team; for an advanced team, CommsEase server will issue a system message to the target user who may approve or reject the request.

  • API prototype
 static bool InviteAsync(const std::string& tid, const std::list<std::string>& ids, const std::string& invitation_postscript, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
ids When creating a team, you need to add user accounts of the team (excluding your own account)
invitation_postscript Invitation postscript, if not empty, this information will be notified to the invited user
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//For example, for test accounts test1, test2
std::string tid = "1231232";
std::list<string> ids;
ids.push_back("test1");
ids.push_back("test2");
nim::Team::InviteAsync(tid,ids,"postscript information",[&](const nim::TeamEvent& teamEvent)=>{
    ....
});

Note: In the normal team , you need to send a message to the team after inviting the friend, otherwise the friend won't receive the invitation notification.

In advanced team, the user can perform the following operations after receiving the notification:

  • Accept the invitation (only for advanced team):static bool AcceptInvitationAsync(const std::string& tid, const std::string& invitor_id,const TeamEventCallback& cb, const std::string& json_extension = "";

Code example

//For example, for inviter account testAccount in test group 1231232
std::string tid = "1231232";
std::string invitor_uid = "testAccount";//Fill in inviter id
nim::Team::AcceptInvitationAsync(tid, invitor_uid, [&](const nim::TeamEvent& teamEvent) 
{
    ...
});
  • Refuse the invitation (only for advanced team):static bool RejectInvitationAsync(const std::string& tid, const std::string& invitor_id,const std::string& reason, const TeamEventCallback& cb, const std::string& json_extension = "";

Code example

//For example, for inviter account testAccount in test group 1231232
std::string tid = "1231232";
std::string invitor_uid = "testAccount";//Fill in inviter id
nim::Team::RejectInvitationAsync(tid, invitor_uid, "Reason for rejection", [&](const nim::TeamEvent& teamEvent) 
{
    ...
});

Team Joining via Active Application

  • API introduction

After sending the request, CommsEase server will send a system message to the team manager who can either accept or refuse the application. Only advanced team has this feature

  • API prototype
 static bool ApplyJoinAsync(const std::string& tid, const std::string& reason, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
reason Application postscript, if not empty, this information will be notified to the manager of the team
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Take test team 1231232 as an example
std::string tid = "1231232";
nim::Team::ApplyJoinAsync(tid, "Application postscript", [&](const nim::TeamEvent& teamEvent) 
{
    ...
});

Team managers can proceed to the next operation:

  • Accept application (only for advanced team):static bool PassJoinApplyAsync(const std::string& tid, const std::string& applicant_id, const TeamEventCallback& cb, const std::string& json_extension = "";

Sample code:

//For example, for test account test1 in test team 1231232
std::string tid = "1231232";
std::string uid = "test1";//Applicant's account
nim::Team::PassJoinApplyAsync(tid, uid, [&](const nim::TeamEvent& teamEvent)
{
   ...
});

  • Reject application (only for advanced team): bool RejectJoinApplyAsync(const std::string& tid, const std::string& applicant_id, const std::string& reason, const TeamEventCallback& cb, const std::string& json_extension = "");

Sample code:

//For example, for test account test1 in test team 1231232
std::string tid = "1231232";
std::string uid = "test1";//Applicant's account
std::string reason = "Because you are not pretty enough";// reason for rejection
nim::Team::RejectJoinApplyAsync(tid, uid, reason, [&](const nim::TeamEvent& teamEvent)
{
   ...
});

Exit Team

There are two types: active withdrawal and passive withdrawal. Both manager and owner have the right to kick out team members. After being kicked out of the team, you will receive a system notification and other users will be notified through team notification event.

  • API prototype
static bool LeaveAsync(const std::string& tid, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Take test team 1231232 as an example
string tid = "1231232";
nim::Team::LeaveAsync(tid, [&](const nim::TeamEvent& teamEvent) 
{
   ...
});

Dismiss Team

Advanced team owner has the right to dismiss the team, which is not available to all the other members. Only advanced team has this feature

  • API prototype
 static bool DismissAsync(const std::string& tid, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Take test team 1231232 as an example
std::string tid = "1231232";
nim::Team::DismissAsync(tid, [&](const nim::TeamEvent& teamEvent) 
{
   ...
});

Remove Member

Team owner can kick out any member, and advanced team manager can kick out regular team members.

  • API prototype
static bool KickAsync(const std::string& tid, const std::list<std::string>& ids, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
ids Collection of ids of members being kicked out
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//For example, for test accounts test1 and test2 in test team 1231232
std::string tid = "1231232";
std::list<std::string> ids;
ids.push_back("test1");
ids.push_back("test2");
nim::Team::KickAsync(tid, ids, [&](const nim::TeamEvent& teamEvent)
{
    ...
});

Mute Team Member

It supports to mute and demute normal members by the manager and owner.

  • API prototype
static bool MuteMemberAsync(const std::string& tid, const std::string& member_id, bool set_mute, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
member_id ids of muted/unmuted team members
set_mute Whether to mute, true: mute, false: unmute
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//For example, for test account test1 in test team 1231232
std::string tid = "1231232";
std::string uid = "test1");
nim::Team::MuteMemberAsync(tid, uid, true, [&](const nim::TeamEvent& teamEvent)
{
    ...
});

Edit Team Information

  • API introduction

All normal team members can update team information such as team name. In advanced team, only the manager can do that.

  • API prototype
static bool UpdateTeamInfoAsync(const std::string& tid, const TeamInfo& team_info, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
team_info In team information, only fill in the fields that need to be updated
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Taking team name update as an example
std::string tid = "1231232";
TeamInfo ti;
ti.SetName("newTeamName");
ti.SetTeamID(tid);
nim::Team::UpdateTeamInfoAsync(tid,ti,[&](const nim::TeamEvent& teamEvent)
{
    ....
});

Update Team Member Information

The SDK allows the manager to change the nicknames of others in the team, and it also allows users to update their own information in the team

Update My Member Information

  • API introduction

Team members can update their own member information.

  • API prototype
static bool UpdateMyPropertyAsync(const TeamMemberProperty& prop, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
prop Team member information. It’s best to get the complete team member information through the interface first, then update the values in fields that need to be updated.TeamIdandAccountIdare required.
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Taking team name update as an example
std::string tid = "1231232";

// Team member information. It’s best to get the complete team member information through the interface first, then update the values in fields that need to be updated. An example is given here.
TeamMemberProperty tmi;
tmi.SetTeamID(tid);
tmi.SetNickName("newNick");
tmi.SetAccountID("myUid"); //My account;
nim::Team::UpdateMyPropertyAsync(tmi, [&](const nim::TeamEvent& teamEvent) 
{
    ...
});

Update In-team nicknames of Other Members

  • API introduction

Manager and owner can update in-team nicknames of other members

  • API prototype
static bool UpdateOtherNickAsync(const TeamMemberProperty& prop, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
prop Team member information,TeamIdandAccountIdare required,NickNamecan be null
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//Taking team name update as an example
std::string tid = "1231232";

// Team member information. It’s best to get the complete team member information through the interface first, then update the values in fields that need to be updated. An example is given here.
TeamMemberProperty tmi;
tmi.SetTeamID(tid);
tmi.SetNickName("newNick");
tmi.SetAccountID("test1"); //Account;
nim::Team::UpdateMyPropertyAsync(tmi, [&](const nim::TeamEvent& teamEvent) 
{
    ...
});

Team Permission Management

The SDK provides permission management feature in advanced team, but operation is limited to manager and team owner. Operations include adding, removing manager and changing team owner, etc.

Add Manager

  • API introduction

Set all in ids as team managers

  • API prototype
static bool AddManagersAsync(const std::string& tid, const std::list<std::string>& ids, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
ids Collection of team member account ids
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//For example, for test accounts test1 and test2 in test team 1231232
std::string tid = "1231232";
std::list<std::string> ids = new string[]();
ids.push_back("test1");
ids.push_back("test2");
nim::Team::AddManagersAsync(tid, ids,[&](const nim::TeamEvent& teamEvent) 
{
    ...
});

Remove Manager

  • API introduction

Remove all managers in managerIdArray

  • API prototype
static bool RemoveManagersAsync(const std::string& tid, const std::list<std::string>& ids, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
ids Collection of team member account ids
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//For example, for test accounts test1 and test2 in test team 1231232
std::string tid = "1231232";
std::list<string> ids = new string[]();
ids.push_back("test1");
ids.push_back("test2");
nim::Team::RemoveManagersAsync(tid, ids,[&](const nim::TeamEvent& teamEvent) 
{
    ...
});


Change the Team Owner

  • API introduction

Transfer owner to another members.is_leave When set to true, the original owner exits the team after successful owner transfer.

  • API prototype
 static bool TransferTeamAsync(const std::string& tid, const std::string& new_owner_id, bool is_leave, const TeamEventCallback& cb, const std::string& json_extension = "");

  • Parameter Description
Parameter Description
tid Team ID
new_owner_id New owner's account id
is_leave Whether the original owner exits the team after successful owner transfer. true: leave after transfer, false: not leave after transfer
cb Notification result callback
json_extension Extension field. Reserved
  • Example
//For example, for test account test1 in test team 1231232
std::string tid = "1231232";
std::string newOwnerId = "test1";
nim::Team::TransferTeamAsync(tid, newOwnerId,true,[&](const nim::TeamEvent& teamEvent) 
{
    ...
});
Was this page helpful?
Yes
No
  • Overview
  • Team Notification Event
  • Get Team
  • Get Local Team List
  • Get Team Information
  • Get Mute List from the Cloud
  • Team Member Information
  • Get Team Member List
  • Get Team Member Information
  • Create A Team
  • Join Team
  • Invite Users to Team
  • Team Joining via Active Application
  • Exit Team
  • Dismiss Team
  • Remove Member
  • Mute Team Member
  • Edit Team Information
  • Update Team Member Information
  • Update My Member Information
  • Update In-team nicknames of Other Members
  • Team Permission Management
  • Add Manager
  • Remove Manager
  • Change the Team Owner