Im channels

From dtyq/magic · View interactive version

Im channels is an AI agent skill from the GitHub repository dtyq/magic. Use when connecting or configuring IM channel bots (WeChat, WeCom, DingTalk, Lark), receiving a user message with an <im> block, or sending messages or files to a connected WeChat channel from the main agent in Claw mode.

How to use this skill

Skill file

IM Channels

This skill covers connecting IM bots, handling incoming IM messages, and explicit WeChat delivery from the main agent in Claw mode.


Scenario A: Incoming Message from an IM Channel

When a user message includes an <im> block at the end, the message was relayed from an IM platform. The block looks like this:

<!-- Text-only message -->
<im source="DingTalk" />

<!-- Message with media attachments -->
<im source="WeChat">
  <media>
    <file type="image" mime="image/jpeg" path="uploads/im-channels/wechat/photo_001.jpg" />
    <file type="voice" mime="audio/silk" path="uploads/im-channels/wechat/voice_001.silk" />
    <file type="image" mime="image/jpeg" path="uploads/im-channels/wechat/photo_002.jpg" from="quoted" />
  </media>
</im>

What each field means

Receiving capabilities

How to respond

Reply controls and long-running work


Scenario B: Connecting an IM Bot

Connect the current Agent to an IM platform so it can receive and send messages in the target app.

Step 1 — Confirm the channel

If the user did not specify one, ask which IM platform they want: WeChat, WeCom, DingTalk, or Lark.

Step 2 — Read the reference

Load the matching file from Channel references for credentials and exact steps.

WeChat and WeCom are completely separate platforms. Do not mix them up.

WeChat uses QR authorization and does not require bot_id or secret.

Step 3 — Collect credentials and connect

Follow the instructions in the reference file. Run the run_sdk_snippet code to establish the connection.

Step 4 — Report the result

If the connection succeeds, tell the user what to do next. If it fails, return the error and guide the next step.

Check Status

To inspect the current configuration and connection state of all IM channels, run:

from sdk.tool import tool

result = tool.call("get_im_channel_status", {})
print(result.content)

Notes

Channel references

Match the incoming source or the channel the user wants to connect:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.