Updated on 2024-04-23 GMT+08:00

WeCom

The WeCom connector allows you to use WeCom functions in a workflow after a few configurations.

WeCom is a communication and office tool designed for enterprises by Tencent. WeCom provides the same communication experience as WeChat, along with rich OA applications and capabilities to connect to the WeChat ecosystem, helping enterprises connect to internal systems, ecosystem partners, and consumers. WeCom features professional collaboration, security management, and people-as-a-service.

Creating a WeCom Connection

  1. Log in to the new ROMA Connect console.
  2. In the navigation pane on the left, choose Connector. On the page displayed, click New Connection.
  3. Select the WeCom connector.
  4. In the dialog box displayed, configure the connector and click OK.

    Parameter

    Description

    Name

    Enter the connector instance name.

    Type

    Select the connection type.

    • Chatbot: Message pushing by chatbot.
    • Application: Other functions.

    Enterprise ID

    Mandatory when the connection type is set to Application.

    Each enterprise has a unique corpid. For details, see "Basic Concepts" in the documentation for WeCom enterprise internal development server APIs.

    AppSecret

    Mandatory when the connection type is set to Application.

    Each application has an independent access secret. For details, see "Basic Concepts" in the documentation for WeCom enterprise internal development server APIs.

    Chatbot Key

    Mandatory when the connection type is set to Chatbot.

    Value of the request parameter key in the robot webhook.

    Description

    Enter the description of the connector to identify it.

Action

  • Obtaining department IDs
  • Creating a department
  • Updating a department
  • Deleting a department
  • Obtaining member IDs
  • Creating a member
  • Updating a member
  • Deleting a member
  • Obtaining a group chat
  • Creating a group chat
  • Modifying a group chat
  • Pushing a text message
  • Pushing a markdown message
  • Pushing a file message
  • Pushing an image message
  • Pushing an image and text message
  • Pushing a text card message
  • Withdrawing an application message
  • Pushing a text message to a group chat
  • Pushing a markdown message to a group chat
  • Pushing a file message to a group chat
  • Pushing an image message to a group chat
  • Pushing a text and image message to a group chat
  • Pushing a text card message to a group chat
  • Pushing a text message by chatbot
  • Pushing a markdown message by chatbot
  • Pushing a file message by chatbot
  • Pushing an image message by chatbot
  • Pushing an image and text message by chatbot

Configuration Parameters

Table 1 Obtaining department IDs

Parameter

Description

Department ID

Obtains a specified department and its sub-departments (and sub-departments of sub-departments, recursively). If left empty, the full organizational structure is obtained by default.

Table 2 Creating a department

Parameter

Description

Dept Name

Department names at the same level must be unique. The value contains 1 to 32 UTF-8 characters and cannot contain the following characters: *?"<>|:

English Name

Department names at the same level must be unique. This takes effect only after the multi-language function is enabled on the management backend. The value contains 1–64 characters, excluding the following characters: *?"<>|:

Parent Dept ID

Parent department ID, which is a 32-digit integer.

Order

Sequence number in the parent department in descending order. Range: [0, 2^32).

Dept ID

If specified, the value must be a 32-digit integer greater than 1. If not specified, a default ID is generated.

Table 3 Updating a department

Parameter

Description

Dept ID

Department ID.

Dept Name

The value contains 1 to 32 UTF-8 characters and cannot contain the following characters: *?"<>|:

English Name

This takes effect only after the multi-language function is enabled on the management backend. The value contains 1–64 characters, excluding the following characters: *?"<>|:

Parent Dept ID

Parent department ID.

Order

Sequence number in the parent department in descending order. Range: [0, 2^32).

Table 4 Deleting a department

Parameter

Description

Dept ID

Department ID.

Table 5 Obtaining member IDs

Parameter

Description

Pagination Cursor

Cursor used for pagination query. The value is a character string and is returned by the last invoking. Leave this empty for the first invoking.

Total Data

Expected requested data volume. Range: 1 to 10000.

Table 6 Creating a member

Parameter

Description

Member ID

Member user ID. Unique management account in an enterprise. Max.: 64 characters. Start with a digit or letter and use only digits, letters, underscores (_), hyphens (-), at signs (@), and periods (.). This is case-insensitive.

Member Name

Max.: 64 UTF-8 characters

Alias

Max.: 64 UTF-8 characters

Gender

1: male; 2: female.

Enable Member

1: enabled; 0: disabled.

Major Dept ID

Major department ID.

Title

Position information. Max.: 128 characters.

Dept IDs

ID list of departments to which the member belongs. Max.: 100 IDs. Separate IDs with commas (,).

Sorting Members in Dept

The default value is 0. Members are sorted by earliest creation time. The number must match that of departments. Values are listed in descending order. Range: [0, 2^32). Separate values with commas (,).

Department Leaders?

The number must match that of departments. The value indicates whether the user is the leader of the department. 1: leader; 0: non-leader. It can be used to identify the upper-level approver in self-built or third-party applications. Separate values with commas (,).

Immediate Superior IDs

User IDs of enterprise members. Max.: 5 IDs. Separate IDs with commas (,).

Fixed-line Phone

The value consists of digits, hyphens (-), plus signs (+), or commas (,). Max.: 32 bytes.

Mobile Number

The value must be unique in an enterprise. Enter either the mobile number or email address, or both.

Email Address

An email address of 6 to 64 bytes. The value must be unique in an enterprise. Enter either the mobile number or email address, or both.

Enterprise Mailbox

Only for enterprises that have enabled the enterprise email function. An email address of 6 to 64 bytes, and must be unique in an enterprise. If not specified, the system generates a default enterprise email address for the user. (The system-generated email address can be changed once only.)

Address

Max.: 128 characters.

Table 7 Updating a member

Parameter

Description

Member ID

Member user ID. Unique management account in an enterprise. The value is case-insensitive and contains 1–64 bytes.

Member Name

Max.: 64 UTF-8 characters

Alias

Max.: 64 UTF-8 characters

Gender

1: male; 2: female.

Enable Member

1: enabled; 0: disabled.

Major Dept ID

Major department ID.

Job Title

Max.: 128 UTF-8 characters.

Dept IDs

IDs of departments to which the member belongs. Max.: 100 IDs. Separate IDs with commas (,).

Sorting Members in Dept

The default value is 0. This parameter is valid when Dept IDs is transferred. The number must match that of departments. Values are listed in descending order. Range: [0, 2^32). Separate values with commas (,).

Department Leaders?

The number must match that of departments. The value indicates whether the member is the department leader. 1: leader; 0: non-leader. Separate values with commas (,).

Immediate Superior IDs

Enterprise members. Max.: 5. Separate IDs with commas (,).

Fixed-line Phone

The value consists of digits, hyphens (-), plus signs (+), or commas (,). Length: 1–32 bytes.

Mobile Number

Phone number, must be unique in an enterprise. If a member has enabled the WeCom account, they need to modify this parameter by themselves. (In this case, this parameter is ignored, and no error is reported.)

Email Address

An email address of up to 64 bytes. It must be unique in an enterprise. If the WeCom account is bound to a Tencent XMail address, this parameter can only be modified in XMail. (In this case, this parameter is ignored, and no error is reported.)

Enterprise Mailbox

This parameter is available only for enterprises that have enabled the enterprise email function. The value is an email address of 6 to 64 bytes, and must be unique in an enterprise. This can be modified once by members whose enterprise email address was system-generated.

Address

Max.: 128 characters.

Table 8 Deleting a member

Parameter

Description

Member ID

Member user ID.

Table 9 Obtaining a group chat

Parameter

Description

Group Chat ID

Group chat ID.

Table 10 Creating a group chat

Parameter

Description

Group Chat Name

Up to 50 UTF-8 characters. Any excess will be truncated.

Group Owner ID

ID of the specified group owner. If not specified, the system randomly selects a user from the user list as the group owner.

Group Member IDs

2 to 2000 members. Separate IDs with commas (,).

Group Chat ID

Unique ID of a group chat. The value is a string of up to 32 characters. Use only digits and uppercase or lowercase letters. If not specified, the system randomly generates a value.

Table 11 Modifying a group chat

Parameter

Description

Group Chat ID

Group chat ID.

Group Chat Name

New group chat name. If no update is required, ignore this parameter. Up to 50 UTF-8 characters. Any excess will be truncated.

Group Owner ID

ID of the new group owner. If no update is required, ignore this parameter. The group owner of a course group chat must be in the group owner list.

Member IDs to Add

IDs of members to be added.

Member IDs to Remove

IDs of members to be removed.

Table 12 Pushing a text message

Parameter

Description

Receiver ID

Member IDs for receiving the message. Separate multiple recipients by vertical bars (|). Max.: 1,000 IDs. Special case: If specified as @all, the message is sent to all members of the enterprise application.

Recipient Dept ID

Department IDs for receiving the message. Separate recipients by vertical bars (|). Max.: 100 IDs. Skip this parameter when the receiver is set to @all.

Enterprise App ID

Enterprise application ID. The value is an integer. It can be viewed on the settings page of the application.

Content

Message content. Max.: 2048 bytes. Any excess will be truncated. (ID translation is supported.)

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked.

Table 13 Pushing a markdown message

Parameter

Description

Receiver ID

Member IDs for receiving the message. Separate multiple recipients by vertical bars (|). Max.: 1,000 IDs. Special case: If this parameter is set to @all, the message is sent to all members of the enterprise application.

Recipient Dept ID

Department IDs for receiving the message. Separate recipients by vertical bars (|). Max.: 100 IDs. Skip this parameter when the receiver is set to @all.

Enterprise App ID

Enterprise application ID. The value is an integer. It can be viewed on the settings page of the application.

Content

Content of the markdown message. The value is UTF-8 encoded and up to 2048 bytes.

Table 14 Pushing a file message

Parameter

Description

Receiver ID

Member IDs for receiving the message. Separate multiple recipients by vertical bars (|). Max.: 1,000 IDs. Special case: If this parameter is set to @all, the message is sent to all members of the enterprise application.

Recipient Dept ID

Department IDs for receiving the message. Separate recipients by vertical bars (|). Max.: 100 IDs. Skip this parameter when the receiver is set to @all.

Enterprise App ID

Enterprise application ID. The value is an integer. It can be viewed on the settings page of the application.

File ID

Can be obtained by invoking the API for uploading temporary materials.

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked.

Table 15 Pushing an image message

Parameter

Description

Receiver ID

Member IDs for receiving the message. Separate multiple recipients by vertical bars (|). Max.: 1,000 IDs. Special case: If this parameter is set to @all, the message is sent to all members of the enterprise application.

Recipient Dept ID

Department IDs for receiving the message. Separate recipients by vertical bars (|). Max.: 100 IDs. Skip this parameter when the receiver is set to @all.

Enterprise App ID

Enterprise application ID. The value is an integer. It can be viewed on the settings page of the application.

Image Media File ID

Can be obtained by invoking the API for uploading temporary materials.

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked.

Table 16 Pushing an image and text message

Parameter

Description

Receiver ID

Member IDs for receiving the message. Separate multiple recipients by vertical bars (|). Max.: 1,000 IDs. Special case: If this parameter is set to @all, the message is sent to all members of the enterprise application.

Recipient Dept ID

Department IDs for receiving the message. Separate recipients by vertical bars (|). Max.: 100 IDs. Skip this parameter when the receiver is set to @all.

Enterprise App ID

Enterprise application ID. The value is an integer. It can be viewed on the settings page of the application.

Subject

Max.: 128 bytes. Any excess will be truncated.

Message Thumbnail

Thumbnail ID of an image and text message. Obtained via the material management API (value of media_id returned by the upload API).

Content

HTML tags are supported. Max.: 666 KB.

Message Author

Max.: 64 bytes.

Source Link

Page link of Read More.

Description

Max.: 512 bytes. Any excess will be truncated.

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked; 2: public within the enterprise.

Table 17 Pushing a text card message

Parameter

Description

Receiver ID

Member IDs for receiving the message. Separate multiple recipients by vertical bars (|). Max.: 1,000 IDs. Special case: If this parameter is set to @all, the message is sent to all members of the enterprise application.

Recipient Dept ID

Department IDs for receiving the message. Separate recipients by vertical bars (|). Max.: 100 IDs. Skip this parameter when the receiver is set to @all.

Enterprise App ID

Enterprise application ID. The value is an integer. It can be viewed on the settings page of the application.

Subject

Max.: 128 bytes. Any excess will be truncated.

Description

Max.: 512 bytes. Any excess will be truncated.

Redirection Link

Max.: 2,048 bytes (HTTP/HTTPS included).

Button Text

The default value is More. Max.: 4 characters. Any excess will be truncated.

Table 18 Withdrawing an application message

Parameter

Description

Message ID

Obtained from the response of the message sending API of the application.

Table 19 Pushing a text message to a group chat

Parameter

Description

Group Chat ID

The group specified by the chat ID must be created by the connected application.

Content

Max.: 2048 bytes. Any excess will be truncated.

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked.

Table 20 Pushing a markdown message to a group chat

Parameter

Description

Group Chat ID

The group specified by the chat ID must be created by the connected application.

Content

Content of the markdown message. The value is UTF-8 encoded and up to 2048 bytes.

Table 21 Pushing a file message to a group chat

Parameter

Description

Group Chat ID

The group specified by the chat ID must be created by the connected application.

File ID

Obtained by invoking the API for uploading temporary materials.

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked.

Table 22 Pushing an image message to a group chat

Parameter

Description

Group Chat ID

The group specified by the chat ID must be created by the connected application.

Image Media File ID

Can be obtained by invoking the API for uploading temporary materials.

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked.

Table 23 Pushing a text and image message to a group chat

Parameter

Description

Group Chat ID

The group specified by the chat ID must be created by the connected application.

Subject

Max.: 128 bytes. Any excess will be truncated.

Message Thumbnail

Thumbnail ID of an image and text message. Obtained via the material management API (value of media_id returned by the upload API).

Content

Message content. HTML tags are supported. Max.: 666 KB.

Message Author

Max.: 64 bytes.

Source Link

Page link of Read More.

Description

Max.: 512 bytes. Any excess will be truncated.

Confidentiality

Whether the message is confidential. 0 (default): public; 1: private and watermarked; 2: public within the enterprise.

Table 24 Pushing a text card message to a group chat

Parameter

Description

Group Chat ID

The group specified by the chat ID must be created by the connected application.

Subject

Max.: 128 bytes. Any excess will be truncated.

Description

Max.: 512 bytes. Any excess will be truncated.

Redirection Link

Max.: 2,048 bytes (HTTP/HTTPS included).

Button Text

The default value is More. Max.: 4 characters. Any excess will be truncated.

Table 25 Pushing a text message by chatbot

Parameter

Description

Content

Max.: 2048 bytes. The excess part will be truncated.

User IDs to Mention

@a member: mention a specified member in the group; @all: mention all members. Separate IDs with commas (,).

Mobile Numbers to Remind

@a member: mention a specified member corresponding to the phone number; @all: mention all members. Separate numbers with commas (,).

Table 26 Pushing a markdown message by chatbot

Parameter

Description

Content

Content of the markdown message. The value is UTF-8 encoded and up to 4096 bytes.

Table 27 Pushing a file message by chatbot

Parameter

Description

File ID

Obtained via the group chatbot file upload API.

Table 28 Pushing an image message by chatbot

Parameter

Description

Base64-encoded Image Content

Base64-encoded image content.

MD5 Value

MD5 value of the image content before Base64 encoding.

Table 29 Pushing an image and text message by chatbot

Parameter

Description

Subject

Max.: 128 bytes. Any excess will be truncated.

Description

Max.: 512 bytes. Any excess will be truncated.

Redirection URL

Click to go to the redirect link.

Image URL

Image link of the image and text message. Available: JPG and PNG formats. Use 1068 x 455 and 150 x 150 sizes for better experience.