Skip to main content
Version: v6.5.0

Add designated employees to a group

Command Description

Pull the designated employee into a group and return the group ID. They can send and receive messages in this group in the future

Command Prototype

GroupId = WxWork.CreateGroup(wxwork_obj, user_list, group_name, group_owner)

Command parameter

parametermandatorytypedefault valueInstructions
wxwork_objTrueexpressionWxWorkObjectEnterprise WeChat object created using the WxWork. Create command
user_listTruearray["ID1", "ID2"]The list of employee IDs to join the group must not exceed the "maximum number of group members" configured by the management end, and the maximum number of group members cannot exceed 2000; Represented in an array, where each element represents an employee ID; note that the array must have at least 2 elements (at least 2 people must be found to join the group), and no more than 2000 elements
group_nameTruestring""Assign a name to the created group, with a maximum of 50 utf8 characters, which will be truncated if exceeded; If empty, automatically generate group name
group_ownerTruestring""Designate an employee ID as the group owner, and ensure that this employee ID is included in the group member list; If empty, randomly designate a member in the group member list as the group leader

Return result

Return_array, Assign the result of running the command to this variable.

Run instance

/********************************* Create a Group with Specified Employees **********************************
Command Prototype:
GroupId = WxWork.CreateGroup(wxwork_obj, user_list, group_name, group_owner)
Input Parameters:
wxwork_obj -- WeChat Work object. Note: WeChat Work object created using the WxWork.Create command.
user_list -- Group member list. Note: List of employee IDs to be added to the group. The number of group members cannot exceed the "maximum group member limit" configured in the admin console, and cannot exceed 2000 people maximum. Represented as an array, where each element represents an employee ID. Note that the array must contain at least 2 elements (minimum 2 people required to create a group), and no more than 2000 elements.
group_name -- Group name. Note: Specify a name for the created group, up to 50 UTF8 characters (will be truncated if exceeded). If empty, a group name will be automatically generated.
group_owner -- Group owner ID. Note: Specify an employee ID as the group owner, and this employee ID must be included in the group member list. If empty, a random member from the group member list will be designated as the group owner.
Output Parameters:
return_array -- Variable to store the output of the function call.
Important Notes:
None
********************************************************************************/
Dim return_array = ""
GroupId = WxWork.CreateGroup(WxWorkObject, ["ID1", "ID2"], "", "")
TracePrint(return_array)