Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send a MiniProgram? #4

Closed
hzzzzzz opened this issue Nov 3, 2020 · 2 comments
Closed

How to send a MiniProgram? #4

hzzzzzz opened this issue Nov 3, 2020 · 2 comments

Comments

@hzzzzzz
Copy link

hzzzzzz commented Nov 3, 2020

Construct a MiniProgram with params like this:

// params are just for example 
const msg = new wechaty.MiniProgram({
  appid: 'foo_appid',
  username: 'foo_name@app',
  title: 'foo_title',
  description: 'blabla',
  pagePath: 'foo_path',
  iconUrl: 'foo_icon',
  thumbUrl: 'foo_url',
  thumbKey: 'foo_key',
});

Error occured when trying send the msg:

Error: originalMessageToUserName is required

Then I looked into the codes:

https://github.com/padlocal/wechaty-puppet-padlocal/blob/5608567a6c8b75839a90f50d61768b06e7391042/src/puppet-padlocal.ts#L797-L802

and in PadLocalClientApi#getEncryptedFile, there was a check for params:

  checkRequiredField(originalMessageToUserName, "originalMessageToUserName");

Obviously, the given value "" for originalMessageToUserName which could not pass the validation caused the error 💡.

I changed the value of originalMessageToUserName to the bot's wechat id manually(is that right? what is originalMessageToUserName?), and sent the msg again...

It worked 🎉! MiniProgram was sent and received successfully.

But another error printed:

Error: can not find message in cache for messageId: xxxxx

😓

So, what is the way to send a MiniProgram correctly?

@padlocal
Copy link
Collaborator

padlocal commented Nov 9, 2020

Thanks for your reporting, this is a client side coding issue. Will be fixed soon.

@padlocal
Copy link
Collaborator

padlocal commented Dec 2, 2020

fixed: 63105ca

@padlocal padlocal closed this as completed Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants