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