wechaty-puppet-padplus icon indicating copy to clipboard operation
wechaty-puppet-padplus copied to clipboard

How to send MiniProgram message in [email protected]

Open su-chang opened this issue 4 years ago • 20 comments

Example

  1. send MiniProgram message
const miniProgram = new MiniProgram({
  appid : 'wxdf0163eaa1cf1699',
  username: 'gh_da3ddad16f56@app',
  title : 'GitHub趋势榜 · 开发者热榜',
  pagePath : 'pages/index/circle.html?share=1&ald_share_src=d7f75884fff428ad45bb4489d209389b',
  description : '开发者热榜',
  thumbUrl : '30580201000451304f02010002041092541302033d0af802046a34feb602045ea12ca4042a777875706c6f61645f777869645f6f7270376469686532706d3131323138325f313538373632313032380204010400030201000400',
  thumbKey : '975c350060cee6d95832a09456ffc1df',
})
await message.say(miniProgram)
  1. forward MiniProgram message
const contact = bot.Contact.load('xxxx')
if (message.type() === MessageType.MiniProgram) {
  await message.forward(contact)
}

Question and Answer

  1. How to get the params of MiniProgram? Please send the MiniProgram to the bot firstly, and then you could get the params from the received MinProgram message.

    Tips

    pagepath -> pagePath cdnthumburl -> thumbUrl cdnthumbaeskey -> thumbKey

  2. Could we set the params of MiniProgram at will? Sorry, we can not guarantee that the params which provided by yourself could work nice here.

If you have any question about MiniProgram, commit your comments below.

su-chang avatar Apr 23 '20 09:04 su-chang

how to upgrade it to v0.7.13, Wechaty has they own puppet-manage,the latest version v0.38.4 still running on "wechaty-puppet-padplus": "^0.6.1"

JesseWeb avatar Apr 23 '20 13:04 JesseWeb

Maybe readme in wechaty-puppet-padplus could help to install and run them. See: https://github.com/wechaty/wechaty-puppet-padplus/blob/master/readme.md#2-install-the-bot-dependency

su-chang avatar Apr 24 '20 02:04 su-chang

I could send or forward MiniProgram message successful by following your issue, it's wonderful. But I found that the message was sent by UrlLink, so it was UrlLink style, any plan to resolve this?

juneyang avatar May 13 '20 09:05 juneyang

For Q&A-2.

I've read PR(Mini program (#225)) Can you add more params of MiniProgram to XML? Such as weappiconurl, shareId, sharekey and sharename.

Thank you very much for reading my comment!

xwxtwd avatar May 13 '20 15:05 xwxtwd

But I found that the message was sent by UrlLink, so it was UrlLink style, any plan to resolve this?

Sorry, it is not in our short-term plan.

su-chang avatar May 18 '20 10:05 su-chang

Can you add more params of MiniProgram to XML? Such as weappiconurl, shareId, sharekey and sharename.

Sorry, due to the basic iPad protocol , we can not provide more params for mini program.

su-chang avatar May 18 '20 10:05 su-chang

Can you add more params of MiniProgram to XML? Such as weappiconurl, shareId, sharekey and sharename.

Sorry, due to the basic iPad protocol , we can not provide more params for mini program.

Thanks, i get it.

xwxtwd avatar May 20 '20 01:05 xwxtwd

Thanks for the informations here! However, I found that the description is not shown in the message, do I miss anything here?

treeguard avatar May 23 '20 05:05 treeguard

In addition, can I adjust the thumbnail size and position?

treeguard avatar May 23 '20 05:05 treeguard

@su-chang I spend some time trying to improve this these days, I saw the miniprogram payload is

export interface MiniProgramParamsPayload { aeskey: string, appid: string, cdnthumbaeskey: string, cdnthumbheight: number, cdnthumblength: number, cdnthumburl: string, cdnthumbwidth: number, description: string, pagepath: string, sourcedisplayname: string, sourceusername: string, title: string, type: number, url: string, username: string, version: string, weappiconurl: string, }

And I try to change the cdnthumbheight, cdnthumburl, cdnthumbwidth, weappiconurl etc. And realized that it doesn't work, I traced the code and I think it's send in the code below const result = await this.requestClient.request({ apiType: ApiType.SEND_MESSAGE, data, }) so does it mean the server side doesn't support these params?

PS: I would like to help on this issue, let me know if it's resolvable or can't be achieved due to the iPad protocol limitation

treeguard avatar May 24 '20 00:05 treeguard

so does it mean the server side doesn't support these params?

Thank you for reading the source code and thinking about the improvement, you are right, in the server side these params are not supported.

It's valuable for the enhancement in the future. Maybe we could add these params here.

Thank you very much.

su-chang avatar May 25 '20 01:05 su-chang

It's valuable for the enhancement in the future. Maybe we could add these params here.

Since the server doesn't support these params, I think it's not urgent to add params on puppet side. Anything I can help on server side to speed up the enhancement?

treeguard avatar May 25 '20 09:05 treeguard

The miniPrograms sent by padplus look different with those sent by normal method:

mini

The upper was sent by padplus, the lower was sent by app.

Any help to solve this?

hzzzzzz avatar May 28 '20 04:05 hzzzzzz

@hzzzzzz https://github.com/wechaty/wechaty-puppet-padplus/issues/226#issuecomment-630093877

su-chang avatar May 28 '20 04:05 su-chang

Ok. Sorry for missing that reply. 😝

hzzzzzz avatar May 28 '20 05:05 hzzzzzz

https://github.com/wechaty/wechaty-puppet-padplus/issues/226#issuecomment-630093877

@su-chang it's essential in our use case to show proper large thumbnail and Mini App name.

If it is feasible, can you point the direction? we can submit PR.

jiabinf avatar May 28 '20 07:05 jiabinf

@jiabinf Sorry to say that we could not support normal style for Mini Program in base level, because the Mini Program message is make from Url Link. So that is the reason why they are look like so similar.

If the proper large image of Mini Program is really important for your user case, please have a try in wechaty-puppet-donut, click here for the token.

su-chang avatar May 28 '20 13:05 su-chang

@su-chang I see. We are using donut in our daily work now, since donut is still under development, we compared padplus to see if it's more robust.

jiabinf avatar May 29 '20 03:05 jiabinf

@su-chang I see. We are using donut in our daily work now, since donut is still under development, we compared padplus to see if it's more robust.

have you tried send miniprogram with donut? Does the image look normal?

treeguard avatar Aug 10 '20 01:08 treeguard

@treeguard If you have any question about donut, please file an issue here, thank you very much.

su-chang avatar Aug 10 '20 01:08 su-chang