agent-messenger 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/README.md +16 -16
- package/.claude-plugin/marketplace.json +29 -29
- package/.claude-plugin/plugin.json +5 -5
- package/.github/workflows/release.yml +0 -12
- package/CONTRIBUTING.md +1 -1
- package/README.md +11 -8
- package/bun.lock +70 -110
- package/bunfig.toml +3 -0
- package/dist/package.json +11 -3
- package/dist/src/platforms/channeltalk/cli.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/cli.js +2 -1
- package/dist/src/platforms/channeltalk/cli.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/index.d.ts +1 -0
- package/dist/src/platforms/channeltalk/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/index.js +1 -0
- package/dist/src/platforms/channeltalk/commands/index.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/whoami.d.ts +22 -0
- package/dist/src/platforms/channeltalk/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/channeltalk/commands/whoami.js +40 -0
- package/dist/src/platforms/channeltalk/commands/whoami.js.map +1 -0
- package/dist/src/platforms/channeltalkbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/cli.js +2 -1
- package/dist/src/platforms/channeltalkbot/cli.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/index.d.ts +1 -0
- package/dist/src/platforms/channeltalkbot/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/index.js +1 -0
- package/dist/src/platforms/channeltalkbot/commands/index.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/whoami.d.ts +13 -0
- package/dist/src/platforms/channeltalkbot/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/channeltalkbot/commands/whoami.js +31 -0
- package/dist/src/platforms/channeltalkbot/commands/whoami.js.map +1 -0
- package/dist/src/platforms/discord/cli.d.ts.map +1 -1
- package/dist/src/platforms/discord/cli.js +2 -1
- package/dist/src/platforms/discord/cli.js.map +1 -1
- package/dist/src/platforms/discord/commands/index.d.ts +1 -0
- package/dist/src/platforms/discord/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/index.js +1 -0
- package/dist/src/platforms/discord/commands/index.js.map +1 -1
- package/dist/src/platforms/discord/commands/whoami.d.ts +6 -0
- package/dist/src/platforms/discord/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/discord/commands/whoami.js +33 -0
- package/dist/src/platforms/discord/commands/whoami.js.map +1 -0
- package/dist/src/platforms/discordbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/cli.js +2 -1
- package/dist/src/platforms/discordbot/cli.js.map +1 -1
- package/dist/src/platforms/discordbot/client.js +2 -2
- package/dist/src/platforms/discordbot/client.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/index.d.ts +1 -0
- package/dist/src/platforms/discordbot/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/index.js +1 -0
- package/dist/src/platforms/discordbot/commands/index.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/whoami.d.ts +14 -0
- package/dist/src/platforms/discordbot/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/discordbot/commands/whoami.js +32 -0
- package/dist/src/platforms/discordbot/commands/whoami.js.map +1 -0
- package/dist/src/platforms/instagram/cli.d.ts.map +1 -1
- package/dist/src/platforms/instagram/cli.js +2 -1
- package/dist/src/platforms/instagram/cli.js.map +1 -1
- package/dist/src/platforms/instagram/client.d.ts +6 -0
- package/dist/src/platforms/instagram/client.d.ts.map +1 -1
- package/dist/src/platforms/instagram/client.js +12 -0
- package/dist/src/platforms/instagram/client.js.map +1 -1
- package/dist/src/platforms/instagram/commands/index.d.ts +1 -0
- package/dist/src/platforms/instagram/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/index.js +1 -0
- package/dist/src/platforms/instagram/commands/index.js.map +1 -1
- package/dist/src/platforms/instagram/commands/whoami.d.ts +7 -0
- package/dist/src/platforms/instagram/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/whoami.js +19 -0
- package/dist/src/platforms/instagram/commands/whoami.js.map +1 -0
- package/dist/src/platforms/kakaotalk/cli.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/cli.js +2 -1
- package/dist/src/platforms/kakaotalk/cli.js.map +1 -1
- package/dist/src/platforms/kakaotalk/client.d.ts +2 -1
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +225 -23
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/index.d.ts +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/index.js +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/whoami.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/whoami.js +19 -0
- package/dist/src/platforms/kakaotalk/commands/whoami.js.map +1 -0
- package/dist/src/platforms/kakaotalk/index.d.ts +2 -2
- package/dist/src/platforms/kakaotalk/index.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/index.js +1 -1
- package/dist/src/platforms/kakaotalk/index.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts +4 -2
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.js +27 -7
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/types.d.ts +17 -0
- package/dist/src/platforms/kakaotalk/protocol/types.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/types.js.map +1 -1
- package/dist/src/platforms/kakaotalk/types.d.ts +28 -0
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/types.js +14 -0
- package/dist/src/platforms/kakaotalk/types.js.map +1 -1
- package/dist/src/platforms/line/cli.js +2 -2
- package/dist/src/platforms/line/cli.js.map +1 -1
- package/dist/src/platforms/line/client.d.ts.map +1 -1
- package/dist/src/platforms/line/client.js +9 -36
- package/dist/src/platforms/line/client.js.map +1 -1
- package/dist/src/platforms/line/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/auth.js +9 -47
- package/dist/src/platforms/line/commands/auth.js.map +1 -1
- package/dist/src/platforms/line/commands/index.d.ts +1 -1
- package/dist/src/platforms/line/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/index.js +1 -1
- package/dist/src/platforms/line/commands/index.js.map +1 -1
- package/dist/src/platforms/line/commands/whoami.d.ts +3 -0
- package/dist/src/platforms/line/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/{profile.js → whoami.js} +5 -5
- package/dist/src/platforms/line/commands/whoami.js.map +1 -0
- package/dist/src/platforms/slack/cli.d.ts.map +1 -1
- package/dist/src/platforms/slack/cli.js +2 -1
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/commands/index.d.ts +1 -0
- package/dist/src/platforms/slack/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/index.js +1 -0
- package/dist/src/platforms/slack/commands/index.js.map +1 -1
- package/dist/src/platforms/slack/commands/whoami.d.ts +6 -0
- package/dist/src/platforms/slack/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/whoami.js +39 -0
- package/dist/src/platforms/slack/commands/whoami.js.map +1 -0
- package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/cli.js +2 -1
- package/dist/src/platforms/slackbot/cli.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/index.d.ts +1 -0
- package/dist/src/platforms/slackbot/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/index.js +1 -0
- package/dist/src/platforms/slackbot/commands/index.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/whoami.d.ts +14 -0
- package/dist/src/platforms/slackbot/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/whoami.js +32 -0
- package/dist/src/platforms/slackbot/commands/whoami.js.map +1 -0
- package/dist/src/platforms/teams/cli.d.ts.map +1 -1
- package/dist/src/platforms/teams/cli.js +2 -1
- package/dist/src/platforms/teams/cli.js.map +1 -1
- package/dist/src/platforms/teams/commands/index.d.ts +1 -0
- package/dist/src/platforms/teams/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/index.js +1 -0
- package/dist/src/platforms/teams/commands/index.js.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.js +2 -0
- package/dist/src/platforms/teams/commands/reaction.js.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.d.ts +6 -0
- package/dist/src/platforms/teams/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/whoami.js +30 -0
- package/dist/src/platforms/teams/commands/whoami.js.map +1 -0
- package/dist/src/platforms/telegram/cli.d.ts.map +1 -1
- package/dist/src/platforms/telegram/cli.js +2 -1
- package/dist/src/platforms/telegram/cli.js.map +1 -1
- package/dist/src/platforms/telegram/commands/index.d.ts +1 -0
- package/dist/src/platforms/telegram/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/index.js +1 -0
- package/dist/src/platforms/telegram/commands/index.js.map +1 -1
- package/dist/src/platforms/telegram/commands/whoami.d.ts +7 -0
- package/dist/src/platforms/telegram/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/whoami.js +27 -0
- package/dist/src/platforms/telegram/commands/whoami.js.map +1 -0
- package/dist/src/platforms/webex/cli.d.ts.map +1 -1
- package/dist/src/platforms/webex/cli.js +2 -1
- package/dist/src/platforms/webex/cli.js.map +1 -1
- package/dist/src/platforms/webex/commands/index.d.ts +1 -0
- package/dist/src/platforms/webex/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/index.js +1 -0
- package/dist/src/platforms/webex/commands/index.js.map +1 -1
- package/dist/src/platforms/webex/commands/message.js +1 -1
- package/dist/src/platforms/webex/commands/message.js.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.d.ts +6 -0
- package/dist/src/platforms/webex/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/whoami.js +30 -0
- package/dist/src/platforms/webex/commands/whoami.js.map +1 -0
- package/dist/src/platforms/wechatbot/cli.d.ts +5 -0
- package/dist/src/platforms/wechatbot/cli.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/cli.js +19 -0
- package/dist/src/platforms/wechatbot/cli.js.map +1 -0
- package/dist/src/platforms/wechatbot/client.d.ts +36 -0
- package/dist/src/platforms/wechatbot/client.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/client.js +208 -0
- package/dist/src/platforms/wechatbot/client.js.map +1 -0
- package/dist/src/platforms/wechatbot/commands/auth.d.ts +28 -0
- package/dist/src/platforms/wechatbot/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/commands/auth.js +164 -0
- package/dist/src/platforms/wechatbot/commands/auth.js.map +1 -0
- package/dist/src/platforms/wechatbot/commands/index.d.ts +6 -0
- package/dist/src/platforms/wechatbot/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/commands/index.js +6 -0
- package/dist/src/platforms/wechatbot/commands/index.js.map +1 -0
- package/dist/src/platforms/wechatbot/commands/message.d.ts +18 -0
- package/dist/src/platforms/wechatbot/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/commands/message.js +80 -0
- package/dist/src/platforms/wechatbot/commands/message.js.map +1 -0
- package/dist/src/platforms/wechatbot/commands/shared.d.ts +9 -0
- package/dist/src/platforms/wechatbot/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/commands/shared.js +13 -0
- package/dist/src/platforms/wechatbot/commands/shared.js.map +1 -0
- package/dist/src/platforms/wechatbot/commands/template.d.ts +19 -0
- package/dist/src/platforms/wechatbot/commands/template.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/commands/template.js +76 -0
- package/dist/src/platforms/wechatbot/commands/template.js.map +1 -0
- package/dist/src/platforms/wechatbot/commands/user.d.ts +20 -0
- package/dist/src/platforms/wechatbot/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/commands/user.js +53 -0
- package/dist/src/platforms/wechatbot/commands/user.js.map +1 -0
- package/dist/src/platforms/wechatbot/commands/whoami.d.ts +12 -0
- package/dist/src/platforms/wechatbot/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/commands/whoami.js +33 -0
- package/dist/src/platforms/wechatbot/commands/whoami.js.map +1 -0
- package/dist/src/platforms/wechatbot/credential-manager.d.ts +17 -0
- package/dist/src/platforms/wechatbot/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/credential-manager.js +121 -0
- package/dist/src/platforms/wechatbot/credential-manager.js.map +1 -0
- package/dist/src/platforms/wechatbot/index.d.ts +5 -0
- package/dist/src/platforms/wechatbot/index.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/index.js +4 -0
- package/dist/src/platforms/wechatbot/index.js.map +1 -0
- package/dist/src/platforms/wechatbot/types.d.ts +94 -0
- package/dist/src/platforms/wechatbot/types.d.ts.map +1 -0
- package/dist/src/platforms/wechatbot/types.js +54 -0
- package/dist/src/platforms/wechatbot/types.js.map +1 -0
- package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/cli.js +2 -1
- package/dist/src/platforms/whatsapp/cli.js.map +1 -1
- package/dist/src/platforms/whatsapp/client.d.ts +9 -0
- package/dist/src/platforms/whatsapp/client.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/client.js +143 -21
- package/dist/src/platforms/whatsapp/client.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/auth.js +133 -60
- package/dist/src/platforms/whatsapp/commands/auth.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/index.d.ts +1 -0
- package/dist/src/platforms/whatsapp/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/index.js +1 -0
- package/dist/src/platforms/whatsapp/commands/index.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/shared.js +2 -2
- package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/whoami.d.ts +7 -0
- package/dist/src/platforms/whatsapp/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/whoami.js +19 -0
- package/dist/src/platforms/whatsapp/commands/whoami.js.map +1 -0
- package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.js +14 -8
- package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -1
- package/dist/src/platforms/whatsapp/ensure-auth.js +2 -2
- package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -1
- package/dist/src/platforms/whatsappbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/cli.js +2 -1
- package/dist/src/platforms/whatsappbot/cli.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/index.d.ts +1 -0
- package/dist/src/platforms/whatsappbot/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/index.js +1 -0
- package/dist/src/platforms/whatsappbot/commands/index.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/whoami.d.ts +17 -0
- package/dist/src/platforms/whatsappbot/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/whoami.js +39 -0
- package/dist/src/platforms/whatsappbot/commands/whoami.js.map +1 -0
- package/dist/src/shared/utils/qr.d.ts +15 -0
- package/dist/src/shared/utils/qr.d.ts.map +1 -0
- package/dist/src/shared/utils/qr.js +74 -0
- package/dist/src/shared/utils/qr.js.map +1 -0
- package/dist/src/tui/adapters/whatsapp-adapter.d.ts.map +1 -1
- package/dist/src/tui/adapters/whatsapp-adapter.js +20 -15
- package/dist/src/tui/adapters/whatsapp-adapter.js.map +1 -1
- package/docs/content/docs/agent-skills.mdx +4 -4
- package/docs/content/docs/cli/channeltalk.mdx +12 -1
- package/docs/content/docs/cli/channeltalkbot.mdx +10 -1
- package/docs/content/docs/cli/discord.mdx +11 -1
- package/docs/content/docs/cli/discordbot.mdx +10 -1
- package/docs/content/docs/cli/instagram.mdx +12 -1
- package/docs/content/docs/cli/kakaotalk.mdx +25 -1
- package/docs/content/docs/cli/line.mdx +5 -5
- package/docs/content/docs/cli/meta.json +1 -0
- package/docs/content/docs/cli/slack.mdx +11 -1
- package/docs/content/docs/cli/slackbot.mdx +10 -1
- package/docs/content/docs/cli/teams.mdx +11 -1
- package/docs/content/docs/cli/telegram.mdx +11 -0
- package/docs/content/docs/cli/webex.mdx +11 -1
- package/docs/content/docs/cli/wechatbot.mdx +188 -0
- package/docs/content/docs/cli/whatsapp.mdx +37 -8
- package/docs/content/docs/cli/whatsappbot.mdx +10 -1
- package/docs/content/docs/sdk/meta.json +1 -1
- package/docs/content/docs/sdk/wechatbot.mdx +282 -0
- package/docs/content/docs/tui.mdx +1 -1
- package/docs/src/app/page.tsx +5 -5
- package/package.json +11 -3
- package/skills/agent-channeltalk/SKILL.md +12 -1
- package/skills/agent-channeltalkbot/SKILL.md +10 -1
- package/skills/agent-discord/SKILL.md +11 -1
- package/skills/agent-discordbot/SKILL.md +10 -1
- package/skills/agent-instagram/SKILL.md +12 -1
- package/skills/agent-kakaotalk/SKILL.md +30 -1
- package/skills/agent-kakaotalk/references/common-patterns.md +1 -1
- package/skills/agent-line/SKILL.md +11 -15
- package/skills/agent-line/references/authentication.md +13 -4
- package/skills/agent-slack/SKILL.md +11 -1
- package/skills/agent-slackbot/SKILL.md +10 -1
- package/skills/agent-teams/SKILL.md +11 -1
- package/skills/agent-telegram/SKILL.md +6 -1
- package/skills/agent-webex/SKILL.md +11 -1
- package/skills/agent-wechatbot/SKILL.md +394 -0
- package/skills/agent-whatsapp/SKILL.md +63 -15
- package/skills/agent-whatsapp/references/authentication.md +36 -6
- package/skills/agent-whatsappbot/SKILL.md +10 -1
- package/src/platforms/channeltalk/cli.ts +2 -0
- package/src/platforms/channeltalk/commands/index.ts +1 -0
- package/src/platforms/channeltalk/commands/whoami.test.ts +64 -0
- package/src/platforms/channeltalk/commands/whoami.ts +62 -0
- package/src/platforms/channeltalkbot/cli.ts +2 -0
- package/src/platforms/channeltalkbot/commands/index.ts +1 -0
- package/src/platforms/channeltalkbot/commands/whoami.test.ts +104 -0
- package/src/platforms/channeltalkbot/commands/whoami.ts +42 -0
- package/src/platforms/discord/cli.ts +2 -0
- package/src/platforms/discord/commands/index.ts +1 -0
- package/src/platforms/discord/commands/whoami.test.ts +91 -0
- package/src/platforms/discord/commands/whoami.ts +36 -0
- package/src/platforms/discord/credential-manager.test.ts +18 -1
- package/src/platforms/discordbot/cli.ts +2 -0
- package/src/platforms/discordbot/client.ts +2 -2
- package/src/platforms/discordbot/commands/index.ts +1 -0
- package/src/platforms/discordbot/commands/whoami.test.ts +96 -0
- package/src/platforms/discordbot/commands/whoami.ts +44 -0
- package/src/platforms/instagram/cli.ts +2 -1
- package/src/platforms/instagram/client.ts +13 -0
- package/src/platforms/instagram/commands/auth.test.ts +216 -0
- package/src/platforms/instagram/commands/chat.test.ts +123 -0
- package/src/platforms/instagram/commands/index.ts +1 -0
- package/src/platforms/instagram/commands/message.test.ts +174 -0
- package/src/platforms/instagram/commands/whoami.test.ts +60 -0
- package/src/platforms/instagram/commands/whoami.ts +21 -0
- package/src/platforms/kakaotalk/cli.ts +2 -1
- package/src/platforms/kakaotalk/client.test.ts +182 -14
- package/src/platforms/kakaotalk/client.ts +261 -27
- package/src/platforms/kakaotalk/commands/auth.test.ts +299 -0
- package/src/platforms/kakaotalk/commands/chat.test.ts +97 -0
- package/src/platforms/kakaotalk/commands/index.ts +1 -0
- package/src/platforms/kakaotalk/commands/message.test.ts +113 -0
- package/src/platforms/kakaotalk/commands/whoami.test.ts +116 -0
- package/src/platforms/kakaotalk/commands/whoami.ts +21 -0
- package/src/platforms/kakaotalk/index.test.ts +5 -0
- package/src/platforms/kakaotalk/index.ts +2 -0
- package/src/platforms/kakaotalk/protocol/session.ts +29 -7
- package/src/platforms/kakaotalk/protocol/types.ts +9 -0
- package/src/platforms/kakaotalk/types.ts +30 -0
- package/src/platforms/line/cli.ts +2 -2
- package/src/platforms/line/client.ts +14 -39
- package/src/platforms/line/commands/auth.test.ts +141 -0
- package/src/platforms/line/commands/auth.ts +37 -61
- package/src/platforms/line/commands/chat.test.ts +110 -0
- package/src/platforms/line/commands/friend.test.ts +98 -0
- package/src/platforms/line/commands/index.ts +1 -1
- package/src/platforms/line/commands/message.test.ts +119 -0
- package/src/platforms/line/commands/whoami.test.ts +85 -0
- package/src/platforms/line/commands/{profile.ts → whoami.ts} +4 -4
- package/src/platforms/slack/cli.ts +2 -0
- package/src/platforms/slack/commands/index.ts +1 -0
- package/src/platforms/slack/commands/whoami.test.ts +126 -0
- package/src/platforms/slack/commands/whoami.ts +40 -0
- package/src/platforms/slackbot/cli.ts +2 -1
- package/src/platforms/slackbot/commands/channel.test.ts +139 -0
- package/src/platforms/slackbot/commands/index.ts +1 -0
- package/src/platforms/slackbot/commands/message.test.ts +226 -0
- package/src/platforms/slackbot/commands/reaction.test.ts +90 -0
- package/src/platforms/slackbot/commands/user.test.ts +143 -0
- package/src/platforms/slackbot/commands/whoami.test.ts +102 -0
- package/src/platforms/slackbot/commands/whoami.ts +44 -0
- package/src/platforms/teams/cli.ts +2 -0
- package/src/platforms/teams/commands/index.ts +1 -0
- package/src/platforms/teams/commands/reaction.test.ts +45 -61
- package/src/platforms/teams/commands/reaction.ts +2 -0
- package/src/platforms/teams/commands/whoami.test.ts +83 -0
- package/src/platforms/teams/commands/whoami.ts +33 -0
- package/src/platforms/telegram/cli.ts +2 -1
- package/src/platforms/telegram/commands/chat.test.ts +125 -0
- package/src/platforms/telegram/commands/index.ts +1 -0
- package/src/platforms/telegram/commands/message.test.ts +92 -0
- package/src/platforms/telegram/commands/whoami.test.ts +75 -0
- package/src/platforms/telegram/commands/whoami.ts +29 -0
- package/src/platforms/webex/cli.ts +2 -1
- package/src/platforms/webex/commands/auth.test.ts +58 -46
- package/src/platforms/webex/commands/index.ts +1 -0
- package/src/platforms/webex/commands/member.test.ts +60 -57
- package/src/platforms/webex/commands/message.test.ts +74 -121
- package/src/platforms/webex/commands/message.ts +1 -1
- package/src/platforms/webex/commands/snapshot.test.ts +54 -45
- package/src/platforms/webex/commands/space.test.ts +46 -49
- package/src/platforms/webex/commands/whoami.test.ts +113 -0
- package/src/platforms/webex/commands/whoami.ts +31 -0
- package/src/platforms/webex/credential-manager.test.ts +0 -1
- package/src/platforms/wechatbot/cli.ts +25 -0
- package/src/platforms/wechatbot/client.test.ts +497 -0
- package/src/platforms/wechatbot/client.ts +268 -0
- package/src/platforms/wechatbot/commands/auth.test.ts +211 -0
- package/src/platforms/wechatbot/commands/auth.ts +203 -0
- package/src/platforms/wechatbot/commands/index.ts +5 -0
- package/src/platforms/wechatbot/commands/message.test.ts +155 -0
- package/src/platforms/wechatbot/commands/message.ts +104 -0
- package/src/platforms/wechatbot/commands/shared.ts +22 -0
- package/src/platforms/wechatbot/commands/template.test.ts +199 -0
- package/src/platforms/wechatbot/commands/template.ts +102 -0
- package/src/platforms/wechatbot/commands/user.test.ts +165 -0
- package/src/platforms/wechatbot/commands/user.ts +75 -0
- package/src/platforms/wechatbot/commands/whoami.test.ts +109 -0
- package/src/platforms/wechatbot/commands/whoami.ts +43 -0
- package/src/platforms/wechatbot/credential-manager.test.ts +255 -0
- package/src/platforms/wechatbot/credential-manager.ts +148 -0
- package/src/platforms/wechatbot/index.test.ts +49 -0
- package/src/platforms/wechatbot/index.ts +19 -0
- package/src/platforms/wechatbot/types.test.ts +223 -0
- package/src/platforms/wechatbot/types.ts +107 -0
- package/src/platforms/whatsapp/cli.ts +2 -1
- package/src/platforms/whatsapp/client.ts +180 -37
- package/src/platforms/whatsapp/commands/auth.test.ts +311 -0
- package/src/platforms/whatsapp/commands/auth.ts +194 -84
- package/src/platforms/whatsapp/commands/chat.test.ts +198 -0
- package/src/platforms/whatsapp/commands/index.ts +1 -0
- package/src/platforms/whatsapp/commands/message.test.ts +231 -0
- package/src/platforms/whatsapp/commands/shared.ts +2 -2
- package/src/platforms/whatsapp/commands/whoami.test.ts +59 -0
- package/src/platforms/whatsapp/commands/whoami.ts +21 -0
- package/src/platforms/whatsapp/credential-manager.test.ts +20 -0
- package/src/platforms/whatsapp/credential-manager.ts +17 -8
- package/src/platforms/whatsapp/ensure-auth.ts +2 -2
- package/src/platforms/whatsappbot/cli.ts +2 -1
- package/src/platforms/whatsappbot/commands/auth.test.ts +217 -0
- package/src/platforms/whatsappbot/commands/index.ts +1 -0
- package/src/platforms/whatsappbot/commands/message.test.ts +198 -0
- package/src/platforms/whatsappbot/commands/template.test.ts +112 -0
- package/src/platforms/whatsappbot/commands/whoami.test.ts +100 -0
- package/src/platforms/whatsappbot/commands/whoami.ts +57 -0
- package/src/shared/utils/qr.ts +92 -0
- package/src/tui/adapters/whatsapp-adapter.ts +19 -16
- package/dist/src/platforms/line/commands/profile.d.ts +0 -3
- package/dist/src/platforms/line/commands/profile.d.ts.map +0 -1
- package/dist/src/platforms/line/commands/profile.js.map +0 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: WeChat Bot
|
|
3
|
+
description: Complete reference for the agent-wechatbot CLI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **Tip**: `agent-wechatbot` is a shortcut for `agent-messenger wechatbot`.
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# 1. Set your API credentials
|
|
12
|
+
agent-wechatbot auth set your-app-id your-app-secret
|
|
13
|
+
|
|
14
|
+
# 2. Verify authentication
|
|
15
|
+
agent-wechatbot auth status
|
|
16
|
+
|
|
17
|
+
# 3. List available templates
|
|
18
|
+
agent-wechatbot template list --pretty
|
|
19
|
+
|
|
20
|
+
# 4. Send a text message (recipient must have interacted within 48h)
|
|
21
|
+
agent-wechatbot message send oXXXXXXXXXXXXXXX "Hello from the CLI!"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Key Concepts
|
|
25
|
+
|
|
26
|
+
WeChat Official Account API works differently from typical messaging APIs:
|
|
27
|
+
|
|
28
|
+
| Concept | Description |
|
|
29
|
+
| ------------------------ | -------------------------------------------------------------------------------- |
|
|
30
|
+
| **Send-only** | Cannot list or read received messages. Inbound messages require webhooks. |
|
|
31
|
+
| **Customer service messages** | Free-form text, image, and news messages within 48h of user's last interaction. |
|
|
32
|
+
| **Template messages** | Pre-approved templates can be sent at any time. Created in the WeChat admin panel. |
|
|
33
|
+
| **App ID + App Secret** | Credentials from WeChat Official Account admin panel under Development settings. |
|
|
34
|
+
| **OpenID** | Each follower has a unique OpenID scoped to your Official Account. |
|
|
35
|
+
| **IP Whitelist** | Your server IP must be added to the account's whitelist or API calls fail (40164). |
|
|
36
|
+
|
|
37
|
+
## Authentication
|
|
38
|
+
|
|
39
|
+
### API Credential Setup
|
|
40
|
+
|
|
41
|
+
agent-wechatbot uses App ID + App Secret pairs from the WeChat Official Account admin panel:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Set credentials (validates against WeChat API before saving)
|
|
45
|
+
agent-wechatbot auth set <app-id> <app-secret>
|
|
46
|
+
|
|
47
|
+
# Check auth status
|
|
48
|
+
agent-wechatbot auth status
|
|
49
|
+
agent-wechatbot auth status --account <account-id>
|
|
50
|
+
|
|
51
|
+
# Clear stored credentials
|
|
52
|
+
agent-wechatbot auth clear
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### How to Get API Credentials
|
|
56
|
+
|
|
57
|
+
1. Log in to the [WeChat Official Account admin panel](https://mp.weixin.qq.com/)
|
|
58
|
+
2. Navigate to **Development > Basic Configuration**
|
|
59
|
+
3. Copy your **App ID** and **App Secret** (you may need to reset the secret if you don't have it saved)
|
|
60
|
+
4. Add your server's IP to the **IP Whitelist**
|
|
61
|
+
5. Run `agent-wechatbot auth set <app-id> <app-secret>`
|
|
62
|
+
|
|
63
|
+
### Multi-Account Management
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# List stored accounts
|
|
67
|
+
agent-wechatbot auth list
|
|
68
|
+
|
|
69
|
+
# Switch active account
|
|
70
|
+
agent-wechatbot auth use <account-id>
|
|
71
|
+
|
|
72
|
+
# Remove a stored account
|
|
73
|
+
agent-wechatbot auth remove <account-id>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
### Whoami Command
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Show current authenticated bot
|
|
82
|
+
agent-wechatbot whoami
|
|
83
|
+
agent-wechatbot whoami --pretty
|
|
84
|
+
agent-wechatbot whoami --account <account-id>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Message Commands
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Send a text message (customer service, within 48h window)
|
|
91
|
+
agent-wechatbot message send <open-id> <text>
|
|
92
|
+
agent-wechatbot message send oABCD1234 "Your order has shipped!"
|
|
93
|
+
|
|
94
|
+
# Send an image message (customer service, within 48h window)
|
|
95
|
+
agent-wechatbot message send-image <open-id> <media-id>
|
|
96
|
+
agent-wechatbot message send-image oABCD1234 MEDIA_ID_HERE
|
|
97
|
+
|
|
98
|
+
# Send a news/article message (customer service, within 48h window)
|
|
99
|
+
agent-wechatbot message send-news <open-id> \
|
|
100
|
+
--title "Title" --description "Desc" --url "https://..." --picurl "https://..."
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Template Commands
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# List all private templates
|
|
107
|
+
agent-wechatbot template list
|
|
108
|
+
|
|
109
|
+
# Send a template message
|
|
110
|
+
agent-wechatbot template send <open-id> <template-id>
|
|
111
|
+
agent-wechatbot template send oABCD1234 TM00001 \
|
|
112
|
+
--data '{"order_id":{"value":"ORD-9876"},"customer_name":{"value":"Alice"}}' \
|
|
113
|
+
--url "https://example.com/order/9876"
|
|
114
|
+
|
|
115
|
+
# Delete a template
|
|
116
|
+
agent-wechatbot template delete <template-id>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### User Commands
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# List followers (paginated)
|
|
123
|
+
agent-wechatbot user list
|
|
124
|
+
agent-wechatbot user list --next-openid oLAST_OPENID
|
|
125
|
+
|
|
126
|
+
# Get user info by OpenID
|
|
127
|
+
agent-wechatbot user get <open-id>
|
|
128
|
+
agent-wechatbot user get oABCD1234 --lang en
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Global Options
|
|
132
|
+
|
|
133
|
+
| Option | Description |
|
|
134
|
+
| ---------------- | -------------------------------------- |
|
|
135
|
+
| `--pretty` | Human-readable output instead of JSON |
|
|
136
|
+
| `--account <id>` | Use a specific account for this command |
|
|
137
|
+
|
|
138
|
+
## Storage
|
|
139
|
+
|
|
140
|
+
Credentials stored in `~/.config/agent-messenger/wechatbot-credentials.json` (0600 permissions).
|
|
141
|
+
|
|
142
|
+
## Limitations
|
|
143
|
+
|
|
144
|
+
- **Cannot list or read received messages** -- WeChat Official Account API delivers inbound messages via webhooks only. This CLI is send-only.
|
|
145
|
+
- **Customer service messages require 48h window** -- Free-form text, image, and news messages only work within 48 hours of the user's last interaction.
|
|
146
|
+
- **Template messages require pre-approval** -- Templates must be created and approved in the WeChat admin panel before use.
|
|
147
|
+
- **IP whitelist required** -- Your server's IP must be added to the Official Account's whitelist (error 40164).
|
|
148
|
+
- **Media IDs required for images** -- Images must be uploaded to WeChat's media platform first. The CLI accepts media IDs, not URLs.
|
|
149
|
+
- **No group chat support** -- Official Account API communicates with individual followers only.
|
|
150
|
+
- **No real-time events / WebSocket connection** -- Inbound messages require a separate webhook server.
|
|
151
|
+
- **No message editing or deletion**
|
|
152
|
+
- **No voice or video calls**
|
|
153
|
+
- **Access tokens expire** -- Tokens are valid for 7200 seconds. The CLI handles automatic refresh.
|
|
154
|
+
|
|
155
|
+
## Troubleshooting
|
|
156
|
+
|
|
157
|
+
### `agent-wechatbot: command not found`
|
|
158
|
+
|
|
159
|
+
**`agent-wechatbot` is NOT the npm package name.** The npm package is `agent-messenger`.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# If installed globally
|
|
163
|
+
agent-wechatbot message send oABCD1234 "Hello"
|
|
164
|
+
|
|
165
|
+
# If not installed, use npx
|
|
166
|
+
npx -y agent-messenger wechatbot message send oABCD1234 "Hello"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### IP whitelist errors (40164)
|
|
170
|
+
|
|
171
|
+
If you get error `40164`, your server's IP is not in the Official Account's whitelist. Add it in the admin panel under **Development > Basic Configuration > IP Whitelist**.
|
|
172
|
+
|
|
173
|
+
### Token errors (40001, 42001)
|
|
174
|
+
|
|
175
|
+
These indicate an expired or invalid access token. The CLI handles automatic token refresh, but if you see persistent errors:
|
|
176
|
+
- Verify your App Secret hasn't been reset in the admin panel
|
|
177
|
+
- Re-run `agent-wechatbot auth set <app-id> <app-secret>` with the current credentials
|
|
178
|
+
|
|
179
|
+
### Rate limiting (45009)
|
|
180
|
+
|
|
181
|
+
WeChat enforces API call frequency limits. If you hit error `45009`, wait before retrying. For bulk operations, add delays between requests.
|
|
182
|
+
|
|
183
|
+
## AI Agent Integration
|
|
184
|
+
|
|
185
|
+
See [`skills/agent-wechatbot/`](https://github.com/agent-messenger/agent-messenger/tree/main/skills/agent-wechatbot) for:
|
|
186
|
+
|
|
187
|
+
- Complete skill documentation
|
|
188
|
+
- Common patterns for AI agent workflows
|
|
@@ -9,14 +9,17 @@ description: Complete reference for the agent-whatsapp CLI.
|
|
|
9
9
|
|
|
10
10
|
WhatsApp integration uses [Baileys](https://github.com/WhiskeySockets/Baileys), a reverse-engineered WhatsApp Web API:
|
|
11
11
|
|
|
12
|
-
- Links as a **companion device** via pairing code, so your phone stays connected.
|
|
12
|
+
- Links as a **companion device** via QR code or pairing code, so your phone stays connected.
|
|
13
13
|
- Each command opens a WebSocket connection on demand and disconnects when done. No persistent background process.
|
|
14
14
|
- Multiple WhatsApp accounts can be linked simultaneously.
|
|
15
15
|
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
# Link as companion device
|
|
19
|
+
# Link as companion device via QR code (scan with your phone)
|
|
20
|
+
agent-whatsapp auth login --qr
|
|
21
|
+
|
|
22
|
+
# Or link via pairing code (enter the code on your phone)
|
|
20
23
|
agent-whatsapp auth login --phone +1234567890
|
|
21
24
|
|
|
22
25
|
# List chats
|
|
@@ -28,16 +31,23 @@ agent-whatsapp message send +1234567890 "Hello from agent-whatsapp"
|
|
|
28
31
|
|
|
29
32
|
## Authentication
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
The CLI supports two authentication methods. Both register as a companion (linked) device, so your phone session is never affected.
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
### QR Code Login
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
agent-whatsapp auth login --qr
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
A QR code is displayed in the terminal and opened in the browser. Scan it with WhatsApp on your phone: Settings > Linked Devices > Link a Device.
|
|
43
|
+
|
|
44
|
+
### Pairing Code Login
|
|
34
45
|
|
|
35
46
|
```bash
|
|
36
|
-
# Start login (displays a pairing code)
|
|
37
47
|
agent-whatsapp auth login --phone +1234567890
|
|
38
48
|
```
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
A numeric pairing code is displayed. Enter it on your phone: WhatsApp > Settings > Linked Devices > Link with phone number.
|
|
41
51
|
|
|
42
52
|
### Account Management
|
|
43
53
|
|
|
@@ -59,6 +69,17 @@ agent-whatsapp auth logout --account <id>
|
|
|
59
69
|
|
|
60
70
|
## Commands
|
|
61
71
|
|
|
72
|
+
### Whoami Command
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Show current authenticated user
|
|
76
|
+
agent-whatsapp whoami
|
|
77
|
+
agent-whatsapp whoami --pretty
|
|
78
|
+
agent-whatsapp whoami --account <account-id>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Output includes the authenticated user's identity information.
|
|
82
|
+
|
|
62
83
|
### Chat Commands
|
|
63
84
|
|
|
64
85
|
```bash
|
|
@@ -135,6 +156,14 @@ npx -y --package agent-messenger agent-whatsapp chat list --pretty
|
|
|
135
156
|
|
|
136
157
|
**NEVER run `npx agent-whatsapp`** without `--package agent-messenger`. It will fail or install a wrong package.
|
|
137
158
|
|
|
159
|
+
### QR code not scanning
|
|
160
|
+
|
|
161
|
+
1. Make sure WhatsApp is open on your phone
|
|
162
|
+
2. Go to Settings > Linked Devices > Link a Device
|
|
163
|
+
3. Point your phone camera at the QR code in the terminal or browser
|
|
164
|
+
4. If the QR code expires, run `auth login --qr` again for a fresh code
|
|
165
|
+
5. If QR scanning fails, try pairing code: `auth login --phone <number>`
|
|
166
|
+
|
|
138
167
|
### Pairing code not working
|
|
139
168
|
|
|
140
169
|
1. Make sure WhatsApp is open on your phone
|
|
@@ -152,12 +181,12 @@ WhatsApp may disconnect linked devices that are inactive for extended periods. I
|
|
|
152
181
|
agent-whatsapp auth status
|
|
153
182
|
|
|
154
183
|
# Re-link if needed
|
|
155
|
-
agent-whatsapp auth login --
|
|
184
|
+
agent-whatsapp auth login --qr
|
|
156
185
|
```
|
|
157
186
|
|
|
158
187
|
## AI Agent Integration
|
|
159
188
|
|
|
160
|
-
See [`skills/agent-whatsapp/`](https://github.com/
|
|
189
|
+
See [`skills/agent-whatsapp/`](https://github.com/agent-messenger/agent-messenger/tree/main/skills/agent-whatsapp) for:
|
|
161
190
|
|
|
162
191
|
- Complete skill documentation
|
|
163
192
|
- Common patterns for AI agent workflows
|
|
@@ -74,6 +74,15 @@ agent-whatsappbot auth remove <account-id>
|
|
|
74
74
|
|
|
75
75
|
## Commands
|
|
76
76
|
|
|
77
|
+
### Whoami Command
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Show current authenticated bot
|
|
81
|
+
agent-whatsappbot whoami
|
|
82
|
+
agent-whatsappbot whoami --pretty
|
|
83
|
+
agent-whatsappbot whoami --account <account-id>
|
|
84
|
+
```
|
|
85
|
+
|
|
77
86
|
### Message Commands
|
|
78
87
|
|
|
79
88
|
```bash
|
|
@@ -163,7 +172,7 @@ WhatsApp enforces rate limits based on your business tier. The CLI automatically
|
|
|
163
172
|
|
|
164
173
|
## AI Agent Integration
|
|
165
174
|
|
|
166
|
-
See [`skills/agent-whatsappbot/`](https://github.com/
|
|
175
|
+
See [`skills/agent-whatsappbot/`](https://github.com/agent-messenger/agent-messenger/tree/main/skills/agent-whatsappbot) for:
|
|
167
176
|
|
|
168
177
|
- Complete skill documentation
|
|
169
178
|
- Common patterns for AI agent workflows
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "TypeScript SDK",
|
|
3
|
-
"pages": ["slack", "discord", "teams", "webex", "whatsapp", "whatsappbot", "line", "instagram", "kakaotalk", "channeltalk", "channeltalkbot"]
|
|
3
|
+
"pages": ["slack", "discord", "teams", "webex", "whatsapp", "whatsappbot", "line", "wechatbot", "instagram", "kakaotalk", "channeltalk", "channeltalkbot"]
|
|
4
4
|
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: WeChat Bot
|
|
3
|
+
description: TypeScript SDK reference for WeChat Bot — Official Account API client, credential management, and types.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install agent-messenger
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import {
|
|
14
|
+
WeChatBotClient,
|
|
15
|
+
WeChatBotCredentialManager,
|
|
16
|
+
WeChatBotError,
|
|
17
|
+
} from 'agent-messenger/wechatbot'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## WeChatBotClient
|
|
21
|
+
|
|
22
|
+
The main client for interacting with the WeChat Official Account API programmatically. Handles access token lifecycle (caching, auto-refresh on expiry), errcode-aware response parsing, and automatic retries on transient errors. All API calls use query-parameter token injection per WeChat convention.
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { WeChatBotClient } from 'agent-messenger/wechatbot'
|
|
26
|
+
|
|
27
|
+
const client = await new WeChatBotClient().login({ appId, appSecret })
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or use automatic credential extraction, where credentials are read from stored config:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { WeChatBotClient } from 'agent-messenger/wechatbot'
|
|
34
|
+
|
|
35
|
+
const client = await new WeChatBotClient().login()
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Verification
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// Verify credentials by attempting to obtain an access token
|
|
42
|
+
const valid = await client.verifyCredentials()
|
|
43
|
+
// → boolean
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Customer Service Messages
|
|
47
|
+
|
|
48
|
+
Customer service messages can be sent to users who have interacted with your Official Account within the last 48 hours.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// Send a text message
|
|
52
|
+
await client.sendTextMessage('oABCD1234', 'Hello from the bot!')
|
|
53
|
+
|
|
54
|
+
// Send an image message (requires a media ID from WeChat's media upload API)
|
|
55
|
+
await client.sendImageMessage('oABCD1234', 'MEDIA_ID_HERE')
|
|
56
|
+
|
|
57
|
+
// Send a news/article message
|
|
58
|
+
await client.sendNewsMessage('oABCD1234', [
|
|
59
|
+
{
|
|
60
|
+
title: 'Your Order Update',
|
|
61
|
+
description: 'Your order #12345 has been shipped',
|
|
62
|
+
url: 'https://example.com/orders/12345',
|
|
63
|
+
picurl: 'https://example.com/images/shipping.jpg',
|
|
64
|
+
},
|
|
65
|
+
])
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Template Messages
|
|
69
|
+
|
|
70
|
+
Template messages can be sent at any time, regardless of the 48-hour interaction window.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// Send a template message
|
|
74
|
+
const result = await client.sendTemplateMessage(
|
|
75
|
+
'oABCD1234',
|
|
76
|
+
'TM00001',
|
|
77
|
+
{ order_id: { value: 'ORD-9876' }, customer_name: { value: 'Alice' } },
|
|
78
|
+
'https://example.com/order/9876', // optional click URL
|
|
79
|
+
)
|
|
80
|
+
console.log(`Message ID: ${result.msgid}`)
|
|
81
|
+
// → { msgid: number }
|
|
82
|
+
|
|
83
|
+
// List all private templates
|
|
84
|
+
const templates = await client.listTemplates()
|
|
85
|
+
// → WeChatBotTemplate[]
|
|
86
|
+
|
|
87
|
+
// Delete a template
|
|
88
|
+
await client.deleteTemplate('TM00001')
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Users
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// List followers (paginated)
|
|
95
|
+
const followers = await client.getFollowers()
|
|
96
|
+
console.log(`Total: ${followers.total}, This page: ${followers.count}`)
|
|
97
|
+
// → { total: number, count: number, openids: string[], next_openid: string }
|
|
98
|
+
|
|
99
|
+
// Get next page
|
|
100
|
+
const nextPage = await client.getFollowers(followers.next_openid)
|
|
101
|
+
|
|
102
|
+
// Get user info
|
|
103
|
+
const user = await client.getUserInfo('oABCD1234', 'en')
|
|
104
|
+
// → WeChatBotUserInfo
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## WeChatBotCredentialManager
|
|
108
|
+
|
|
109
|
+
Manages WeChat Bot credentials stored at `~/.config/agent-messenger/wechatbot-credentials.json`. Files are written with `0o600` permissions. The environment variables `E2E_WECHATBOT_APP_ID` and `E2E_WECHATBOT_APP_SECRET` take precedence when calling `getCredentials()` without an `accountId`.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { WeChatBotCredentialManager } from 'agent-messenger/wechatbot'
|
|
113
|
+
|
|
114
|
+
const manager = new WeChatBotCredentialManager()
|
|
115
|
+
// Custom path: new WeChatBotCredentialManager('/custom/config/dir')
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
// Load full config from disk (returns defaults if file doesn't exist)
|
|
120
|
+
const config = await manager.load()
|
|
121
|
+
// → WeChatBotConfig
|
|
122
|
+
|
|
123
|
+
// Save full config to disk
|
|
124
|
+
await manager.save(config)
|
|
125
|
+
|
|
126
|
+
// Get credentials for an account (env vars take precedence)
|
|
127
|
+
const creds = await manager.getCredentials()
|
|
128
|
+
const specific = await manager.getCredentials(accountId)
|
|
129
|
+
// → WeChatBotCredentials | null
|
|
130
|
+
|
|
131
|
+
// Store credentials for an account
|
|
132
|
+
await manager.setCredentials({
|
|
133
|
+
app_id: 'wx1234567890',
|
|
134
|
+
app_secret: '...',
|
|
135
|
+
account_name: 'wx1234567890',
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
// Remove an account's credentials
|
|
139
|
+
const removed = await manager.removeAccount('wx1234567890')
|
|
140
|
+
// → boolean
|
|
141
|
+
|
|
142
|
+
// Set the current default account
|
|
143
|
+
const ok = await manager.setCurrent('wx1234567890')
|
|
144
|
+
// → boolean
|
|
145
|
+
|
|
146
|
+
// List all saved accounts with current marker
|
|
147
|
+
const all = await manager.listAll()
|
|
148
|
+
// → Array<WeChatBotAccountEntry & { is_current: boolean }>
|
|
149
|
+
|
|
150
|
+
// Clear all stored credentials
|
|
151
|
+
await manager.clearCredentials()
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Types
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import type {
|
|
158
|
+
WeChatBotAccountEntry,
|
|
159
|
+
WeChatBotConfig,
|
|
160
|
+
WeChatBotCredentials,
|
|
161
|
+
WeChatBotNewsArticle,
|
|
162
|
+
WeChatBotTemplate,
|
|
163
|
+
WeChatBotUserInfo,
|
|
164
|
+
} from 'agent-messenger/wechatbot'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## WeChatBotError
|
|
168
|
+
|
|
169
|
+
Thrown on authentication failures, network errors, rate limits, and API errors. Includes a `code` string for programmatic handling.
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import { WeChatBotError } from 'agent-messenger/wechatbot'
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
await client.sendTextMessage('oABCD1234', 'Hello')
|
|
176
|
+
} catch (error) {
|
|
177
|
+
if (error instanceof WeChatBotError) {
|
|
178
|
+
console.error(`${error.code}: ${error.message}`)
|
|
179
|
+
// e.g. "40001: Invalid credential"
|
|
180
|
+
// e.g. "45009: Reach max API daily quota limit"
|
|
181
|
+
// e.g. "40164: Invalid ip, not in whitelist"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Zod Schemas
|
|
187
|
+
|
|
188
|
+
Runtime-validated schemas are also exported for parsing API responses:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import {
|
|
192
|
+
WeChatBotAccountEntrySchema,
|
|
193
|
+
WeChatBotConfigSchema,
|
|
194
|
+
WeChatBotCredentialsSchema,
|
|
195
|
+
WeChatBotNewsArticleSchema,
|
|
196
|
+
WeChatBotTemplateSchema,
|
|
197
|
+
WeChatBotUserInfoSchema,
|
|
198
|
+
} from 'agent-messenger/wechatbot'
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Examples
|
|
202
|
+
|
|
203
|
+
### Send Template Notification
|
|
204
|
+
|
|
205
|
+
Send a template message with dynamic data to a follower.
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
import { WeChatBotClient } from 'agent-messenger/wechatbot'
|
|
209
|
+
|
|
210
|
+
const client = await new WeChatBotClient().login({ appId, appSecret })
|
|
211
|
+
|
|
212
|
+
const result = await client.sendTemplateMessage(
|
|
213
|
+
'oABCD1234',
|
|
214
|
+
'order_confirmation',
|
|
215
|
+
{
|
|
216
|
+
order_id: { value: 'ORD-5678' },
|
|
217
|
+
status: { value: 'Shipped' },
|
|
218
|
+
date: { value: 'March 30, 2026' },
|
|
219
|
+
},
|
|
220
|
+
'https://example.com/orders/5678',
|
|
221
|
+
)
|
|
222
|
+
console.log(`Sent template, msgid: ${result.msgid}`)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Broadcast to All Followers
|
|
226
|
+
|
|
227
|
+
Iterate through paginated follower list and send template messages.
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
import { WeChatBotClient } from 'agent-messenger/wechatbot'
|
|
231
|
+
|
|
232
|
+
const client = await new WeChatBotClient().login({ appId, appSecret })
|
|
233
|
+
|
|
234
|
+
let nextOpenId: string | undefined
|
|
235
|
+
do {
|
|
236
|
+
const page = await client.getFollowers(nextOpenId)
|
|
237
|
+
for (const openId of page.openids) {
|
|
238
|
+
await client.sendTemplateMessage(openId, 'weekly_update', {
|
|
239
|
+
content: { value: 'New features released this week!' },
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
nextOpenId = page.next_openid || undefined
|
|
243
|
+
} while (nextOpenId)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Multi-Account Management
|
|
247
|
+
|
|
248
|
+
Set up and switch between multiple Official Account credentials.
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { WeChatBotCredentialManager, WeChatBotClient } from 'agent-messenger/wechatbot'
|
|
252
|
+
|
|
253
|
+
const manager = new WeChatBotCredentialManager()
|
|
254
|
+
|
|
255
|
+
// Store credentials for two accounts
|
|
256
|
+
await manager.setCredentials({
|
|
257
|
+
app_id: 'wx1111111111',
|
|
258
|
+
app_secret: 'secret1...',
|
|
259
|
+
account_name: 'wx1111111111',
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
await manager.setCredentials({
|
|
263
|
+
app_id: 'wx2222222222',
|
|
264
|
+
app_secret: 'secret2...',
|
|
265
|
+
account_name: 'wx2222222222',
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
// List all accounts
|
|
269
|
+
const accounts = await manager.listAll()
|
|
270
|
+
for (const acct of accounts) {
|
|
271
|
+
const marker = acct.is_current ? '(current)' : ''
|
|
272
|
+
console.log(`${acct.account_name} [${acct.app_id}] ${marker}`)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Switch to a specific account
|
|
276
|
+
await manager.setCurrent('wx1111111111')
|
|
277
|
+
|
|
278
|
+
// Login picks up the current account automatically
|
|
279
|
+
const client = await new WeChatBotClient().login()
|
|
280
|
+
const valid = await client.verifyCredentials()
|
|
281
|
+
console.log(`Credentials valid: ${valid}`)
|
|
282
|
+
```
|
|
@@ -113,7 +113,7 @@ This means adding a new platform to the TUI is just implementing one adapter —
|
|
|
113
113
|
|
|
114
114
|
## Source
|
|
115
115
|
|
|
116
|
-
The TUI source lives in [`src/tui/`](https://github.com/
|
|
116
|
+
The TUI source lives in [`src/tui/`](https://github.com/agent-messenger/agent-messenger/tree/main/src/tui):
|
|
117
117
|
|
|
118
118
|
```
|
|
119
119
|
src/tui/
|
package/docs/src/app/page.tsx
CHANGED
|
@@ -543,7 +543,7 @@ const HOW_IT_WORKS = [
|
|
|
543
543
|
{
|
|
544
544
|
step: 3,
|
|
545
545
|
title: 'Teach Your Agent',
|
|
546
|
-
code: 'npx skills add
|
|
546
|
+
code: 'npx skills add agent-messenger/agent-messenger',
|
|
547
547
|
description: 'Install Agent Skills via Skills CLI, Claude Code, OpenCode, or SkillPad — your agent learns every command and starts messaging on its own.',
|
|
548
548
|
},
|
|
549
549
|
]
|
|
@@ -617,7 +617,7 @@ export default function Home() {
|
|
|
617
617
|
docs
|
|
618
618
|
</Link>
|
|
619
619
|
<a
|
|
620
|
-
href="https://github.com/
|
|
620
|
+
href="https://github.com/agent-messenger/agent-messenger"
|
|
621
621
|
target="_blank"
|
|
622
622
|
rel="noopener noreferrer"
|
|
623
623
|
className="rounded-lg px-3 py-2 font-mono text-xs text-zinc-500 transition-colors hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-100"
|
|
@@ -661,7 +661,7 @@ export default function Home() {
|
|
|
661
661
|
Get Started
|
|
662
662
|
</Link>
|
|
663
663
|
<a
|
|
664
|
-
href="https://github.com/
|
|
664
|
+
href="https://github.com/agent-messenger/agent-messenger"
|
|
665
665
|
target="_blank"
|
|
666
666
|
rel="noopener noreferrer"
|
|
667
667
|
className="inline-flex items-center justify-center rounded-xl border border-zinc-300 px-6 py-3 text-sm font-medium text-zinc-700 transition-all duration-300 hover:bg-zinc-50 dark:border-white/[0.06] dark:text-zinc-300 dark:hover:border-white/15 dark:hover:bg-white/[0.05]"
|
|
@@ -1002,7 +1002,7 @@ export default function Home() {
|
|
|
1002
1002
|
Read the Docs
|
|
1003
1003
|
</Link>
|
|
1004
1004
|
<a
|
|
1005
|
-
href="https://github.com/
|
|
1005
|
+
href="https://github.com/agent-messenger/agent-messenger"
|
|
1006
1006
|
target="_blank"
|
|
1007
1007
|
rel="noopener noreferrer"
|
|
1008
1008
|
className="inline-flex items-center justify-center rounded-xl border border-zinc-300 px-6 py-3 text-sm font-medium text-zinc-700 transition-all duration-300 hover:bg-white dark:border-white/[0.06] dark:text-zinc-300 dark:hover:border-white/15 dark:hover:bg-white/[0.05]"
|
|
@@ -1024,7 +1024,7 @@ export default function Home() {
|
|
|
1024
1024
|
docs
|
|
1025
1025
|
</Link>
|
|
1026
1026
|
<a
|
|
1027
|
-
href="https://github.com/
|
|
1027
|
+
href="https://github.com/agent-messenger/agent-messenger"
|
|
1028
1028
|
target="_blank"
|
|
1029
1029
|
rel="noopener noreferrer"
|
|
1030
1030
|
className="transition-colors duration-300 hover:text-zinc-700 dark:hover:text-zinc-300"
|