wechaty / wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
https://wechaty.js.org/docs/puppet-services/
317 stars 65 forks source link

How to send MiniProgram message in padplus@0.7.13 #226

Open su-chang opened 4 years ago

su-chang commented 4 years ago

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)
  2. 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.

JesseWeb commented 4 years ago

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"

su-chang commented 4 years ago

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

juneyang commented 4 years ago

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?

xwxtwd commented 4 years ago

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!

su-chang commented 4 years ago

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 commented 4 years ago

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.

xwxtwd commented 4 years ago

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.

treeguard commented 4 years ago

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

treeguard commented 4 years ago

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

treeguard commented 4 years ago

@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

su-chang commented 4 years ago

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.

treeguard commented 4 years ago

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?

hzzzzzz commented 4 years ago

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?

su-chang commented 4 years ago

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

hzzzzzz commented 4 years ago

Ok. Sorry for missing that reply. 😝

jiabinf commented 4 years ago

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.

su-chang commented 4 years ago

@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.

jiabinf commented 4 years ago

@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.

treeguard commented 4 years ago

@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?

su-chang commented 4 years ago

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