SuperAPI AI Directory

wecom-msg

Office & productivity

View repository

Updated 10-16 08:33

About this skill

Enterprise WeChat message skill

wecom_mcp is an MCP tool; all operations are completed by calling this tool.

⚠️ Prerequisites: before the first call to wecom_mcp , you must follow the wecom-preflight skill to perform prerequisite checks to ensure the tool has been added to the whitelist.

Interact with the Enterprise WeChat message system via wecom_mcp call msg <接口名> '<json入参>' .


Interface list

get_msg_chat_list — get conversation list

Use the wecom_mcp tool to call wecom_mcp call msg get_msg_chat_list '{"begin_time": "2026-03-11 00:00:00", "end_time": "2026-03-17 23:59:59"}'

Query the list of conversations with messages by time range, supporting pagination. See API details。

get_messages — retrieve conversation messages

Use the wecom_mcp tool to call wecom_mcp call msg get_messages '{"chat_type": 1, "chatid": "zhangsan", "begin_time": "2026-03-17 09:00:00", "end_time": "2026-03-17 18:00:00"}'

Retrieve message records within a specified time range based on conversation type and ID, supporting pagination. Only supports within 7 days. See API details。

send_message — send text message

Use the wecom_mcp tool to call wecom_mcp call msg send_message '{"chat_type": 1, "chatid": "zhangsan", "msgtype": "text", "text": {"content": "hello world"}}'

Send a text message to a one-on-one chat or group chat. See API details。


Core rules

Time range rules

  • Format: all time parameters use the YYYY-MM-DD HH:mm:ss format
  • Default range: when the user does not specify, default to the last 7 days (7 days back from the current time)
  • Limit: the start time cannot be earlier than 7 days before the current time, and cannot be later than the current time
  • Relative time support: supports automatic calculation of "yesterday", "last three days", etc.

chatid lookup rules

  • When the user provides a person name or group name instead of an ID:
    1. Call get_msg_chat_list to get the conversation list (time range consistent with the target query)
    2. In chats match by chat_name match
    3. Matching strategy:
      • Exact match with a unique result: use it directly
      • Fuzzy match with multiple results: display the candidate list for the user to choose
      • No match: tell the user that none was found
  • chat_type determination:get_msg_chat_list The return does not include a conversation type field; it must be inferred from context: when the user explicitly mentions "group", use chat_type=2, otherwise default to chat_type=1(one-on-one chat)

userid to username

Process:

  1. Call wecom-contact-lookup get_userlist to get the user list
  2. Establish the mapping relationship from userid to username
  3. Display strategy:
    • Exact match: display username
    • No match: keep displaying userid

Typical workflow

View conversation list

Example user query:

  • "Let me see what chats I have had in the last week"
  • "Who has sent me messages these past few days"

Execution process:

  1. Determine the time range (user-specified or default to the last 7 days)
  2. Call get_msg_chat_list to get the conversation list
  3. Display the conversation name, last message time, and message count
  4. If has_more is true, inform the user that there are more conversations to continue viewing

View chat history

User query example:

  • "Help me check the recent chat history with Zhang San"
  • "Check the recent messages in the project group"

Execution process:

  1. Determine the time range (user-specified or default to the last 7 days)
  2. Through chatid lookup rule determine the target conversation's chatid and chat_type
  3. Call get_messages to retrieve the message list
  4. Call wecom-contact-lookup 's get_userlist to get the contact list and build a userid→name mapping
  5. When displaying messages, replace userid with a readable name, format:姓名 [时间]: 内容
  6. If next_cursor is not empty, inform the user that there are more messages to continue viewing

Send message

User query example:

  • "Help me send a message to Zhang San: tomorrow's meeting is moved to 3 PM"
  • "Send a message in the project group: the meeting is at 3 PM today"

Execution process:

  1. Through chatid lookup rule determine the target conversation's chatid and chat_type
  2. Confirm before sending: confirm with the user the recipient and content (e.g.: "About to send to Zhang San: 'tomorrow's meeting is moved to 3 PM', confirm sending?"), and execute after the user confirms
  3. Call send_message to send (msgtype is fixed to text)
  4. Display the sending result

View messages and reply

User query example:

  • "See what Zhang San sent me, then help me reply 'received'"

Execution process:

  1. First execute the "View chat history" process (reuse the already obtained chatid and chat_type)
  2. After displaying the messages, execute the "Send message" process (confirmation required before sending)

Error handling

  • Time range exceeds limit: inform the user of the 7-day limit and adjust to a valid range
  • Conversation not found: clearly inform the user that the corresponding conversation was not found
  • API error: display the specific error message, and retry if necessary
  • Network issue: proactively retry up to 3 times on HTTP errors`