inviteInGroup
Introduction
Invite some members from a specific group.
Parameter details
Parameter name |
Parameter type |
Required |
Platform |
Description |
inviteeList |
List< String > |
yes |
All |
The ID of the target user to invite. |
groupID |
String |
yes |
All |
The group ID. |
data |
String |
yes |
All |
The custom data carried by the invitation. |
timeout |
int |
no |
All |
The timeout configuration of the invitation. 30 seconds as default, while 0 represent will not timeout. |
onlineUserOnly |
bool |
no |
All |
Whether the message can be received by online users only. |
Returned template
V2TimValueCallback<String>
{
code : int
desc : String
data : String
}
Return value details
name |
type |
description |
code |
int |
Request result: Error codes. 0 means success. |
desc |
String |
The description of the error. It will be empty if success. |
data |
bool |
The ID of the invitation created. |
Code example
V2TimSignalingListener listener = V2TimSignalingListener(
onInvitationCancelled:
(String inviteID, String inviter, String data) async {},
onInvitationTimeout: (String inviteID, List<String> inviteeList) async {
},
onInviteeAccepted: (String inviteID, String invitee, String data) async {
},
onInviteeRejected: (String inviteID, String invitee, String data) async {
},
onReceiveNewInvitation: (String inviteID, String inviter, String groupID,
List<String> inviteeList, String data) async {
},
);
TencentImSDKPlugin.v2TIMManager
.getSignalingManager()
.addSignalingListener(listener: listener);
V2TimValueCallback<String> inviteInGroupRes =
await TencentImSDKPlugin.v2TIMManager.getSignalingManager().inviteInGroup(
inviteeList: [],
groupID: "",
data: "data",
timeout: 30,
onlineUserOnly: false,
);
if (inviteInGroupRes.code == 0) {
String? inviteId = inviteInGroupRes.data;
}