Wechat Work Node icon

Wechat Work Node

Wechat Work Node

用户管理 → 创建成员

AI-generated

Summary

Create a new member in the WeChat Work enterprise with specified details including user ID, name, contact information, department membership, and other optional attributes.

Inputs

  • userid (required) — Unique member UserID within the enterprise; 1 to 64 bytes, comprising digits, letters, and characters '_-@.', starting with a digit or letter; uniqueness check is case-insensitive.
  • name (required) — Member's name; 1 to 64 UTF-8 characters.
  • alias — Member alias; 1 to 64 UTF-8 characters.
  • mobile — Mobile phone number unique within the enterprise; either mobile or email must be provided.
  • department — List of departments (up to 100) the member belongs to, each including department ID (required), order, and leadership status within the department. If empty or department ID is 0, member is assigned to an unspecified department. Non-existing departments will be created under the unspecified category.
  • position — Member's position or job title.
  • gender — Gender of the member; '1' for male, '2' for female. Defaults to '1'.
  • email — Email address.
  • biz_mail — Enterprise email address.
  • telephone — Telephone landline number.
  • direct_leader — List with up to one direct leader UserID within the enterprise.
  • avatar_mediaid — Media ID of the member's avatar image, obtained via media upload.
  • address — Member's address.
  • main_department — Boolean indicating if the main department field is set; defaults to true.
  • enable — Boolean to enable or disable the member; defaults to true.
  • to_invite — Boolean whether to invite the member to use WeChat Work; defaults to true.
  • json — Additional attributes in JSON format such as external_profile or external_position.

Output shape

a JSON object representing the API response from WeChat Work for member creation

The operation sends a POST request to /cgi-bin/user/create with the constructed member data and returns the WeChat Work API response. Errors are thrown if the API responds with failure codes.

Examples

Example 1: Create a new WeChat Work member with mandatory and optional information

Provide a unique userid, member name, at least one contact method (mobile or email), department list, and optional fields such as position and avatar media ID.

Links

Discussion