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 get the wx_id when user had wx account? #1658

Closed
xmsz opened this issue Nov 26, 2018 · 2 comments
Closed

How to get the wx_id when user had wx account? #1658

xmsz opened this issue Nov 26, 2018 · 2 comments
Labels

Comments

@xmsz
Copy link

xmsz commented Nov 26, 2018

1. Expected behavior

Question: What behavior do you expect?

Answer: Get wx_id from Contact.id not wx account

2. Actual behavior

Question: What actual behavior did you experience?

Answer: When user had set the wx account (ex: test), it will return 'test'. But, I want the wx id ,not the wx account.
Case, wx_id is unique, wx account can be changed

@xmsz xmsz changed the title How to get the wx_id when use had wx account? How to get the wx_id when user had wx account? Nov 26, 2018
@lijiarui
Copy link
Member

lijiarui commented Nov 26, 2018

Get wx_id from Contact.id not wx account

Yes, using Contact.id just can get contact unique id according to the puppet. It cannot get weixin id. See more: #1644 #90 #1276 #133 #1307

About wechaty API

  • If you want to get weixin id, you can use Contact.weixin(), but this isn't supported at this time, it is coming very soon! see [RFC] custom id on Contact #1647
  • If you want to get wx account(maybe you mean nickname), you can call Contact.name()

About Contact unique id

  • If you are using iPad version, Contact.id is unique ID of and always the same id across sessions. It means when you login again, you always get this unique id.
  • If you are using Web version, Contact.id is unique id but it will change across sessions. It means when you login again, you may get a different id even it is the same user.

@xmsz
Copy link
Author

xmsz commented Nov 26, 2018

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants