收藏
回答

How can I get the Unionid from the openid?

Dear all,

I have an Open Platform account. In the Open Platform, I have configured two components:

* Website Application - To let users authorize my website from their desktop browsers using their WeChat account. This is an oauth2-based login that really fits what we look for.

* Third-Party Platform - To be able to operate on behalf of an Official Account and send template messages.

My web offers a service, so I want to send informational template messages to my users. For each logged user, I have both its openid (note this is specific to the website application) and its unionid. In order to send them a message, I need to figure out what its other openid is (the one specific to the third-party platform). How can I get this value?

I know I can store a cache of all the followers of the authorizer Official Account, but let's say the Official Account authorizing my Third-Party has several millions of followers. I'd need to pre-store this huge list and then handle every follow/unfollow event, all of this just to be able to get an openid from a unionid. I am sure I'm missing something.

Thank you!

回答关注问题邀请回答
收藏

1 个回答

  • 青寒
    青寒
    2020-08-17

    暂时没查到根据unionid获取其他平台openid的方法。

    unionid的作用是区分用户的唯一性;

    openid的作用是区分应用的唯一性;

    如果你现在没有unionid,要怎么给百万级别用户的第三方平台发送模板消息呢?

    感觉还是得有个用户的存储表,记录用户的相关信息(至少有openid),这样你才能调用接口给用户发消息;

    而unionid的作用,只是帮助你辨别出用户在其他应用的对应身份。

    2020-08-17
    有用
    回复 2
    • 艾睿德
      艾睿德
      2020-08-18
      Hi! First of all, thank you for your response.


      Yeah, I have that storage, but only to be able to match between website app and third-party platform open ids. In other words: to help me identify the identity of a user in another application, because as far as I know the official API does provide a mechanism to do this at the moment.


      Usage case: 


      1. User logs in (using the website application) scanning a QR code in his/her desktop browser.

      2. He/she made a purchase.
      3. Once the order is ready, if he/she is a follower, we want to send a notification (using the third-party platform).




      This is all I need.


      Only a few of my followers will log in to my page. However, I need to store the information of millions of them just because I need to look up users using unionids to identify the identitiy of a user in another platform. I know this works. And this how I have it right know. But I found it confusing.


      Again, I might be missing something :(


      Thank you! :)
      2020-08-18
      回复
    • 青寒
      青寒
      2020-08-18回复艾睿德
      这我就不清楚了,看看社区客服或其他用户能不能给个方案吧。
      2020-08-18
      回复
登录 后发表内容
问题标签