wechaty / wechaty

Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
https://wechaty.js.org
Apache License 2.0
20.47k stars 2.61k forks source link

除了ipad协议外,其他协议都不能发送小程序卡片和H5卡片是什么问题? #2668

Open linxiulan opened 7 months ago

linxiulan commented 7 months ago

如题

dosubot[bot] commented 7 months ago

The issue you're experiencing with sending mini-program cards and H5 cards, except through the iPad protocol, likely stems from the specific wechaty-puppet you're using and the WeChat API's limitations. Not all puppet implementations support all features, which can lead to discrepancies in functionality like the one you're encountering.

For sending mini-program and H5 cards, ensure your code aligns with the Wechaty SDK's capabilities. Here's a quick guide:

Mini-Program Card:

const miniProgramPayload = new MiniProgram ({
  username: 'gh_xxxxxxx', // from mp.weixin.qq.com
  appid: '', // optional, from mp.weixin.qq.com
  title: '', // optional
  pagepath: '', // optional
  description: '', // optional
  thumbnailurl: '', // optional
});
await msg.say(miniProgramPayload);

H5 Card:

const linkPayload = new UrlLink ({
  description: 'WeChat Bot SDK for Individual Account',
  thumbnailUrl: 'https://avatars0.githubusercontent.com/u/25162437?s=200&v=4',
  title: 'Welcome to Wechaty',
  url: 'https://github.com/wechaty/wechaty',
});
await msg.say(linkPayload);

If issues persist, providing more details about the puppet you're using and any error messages could help diagnose the problem further.

Sources

#### About Dosu This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.