# WeChat Channels live streaming sharing attribution

# wx.getChannelsShareKey()

Get shared information. When the field is empty, there is no sharing information.

This interface returns the sharing information when the following three requirements are met at the same time:

  1. Users can access Weixin Mini Program by sharing cards in WeChat Channels live streaming rooms, sharing cards for products in live streaming rooms, sharing cards for showcases, and sharing cards for products in showcases.
  2. These WeChat Channels are for Weixin Mini Program promoters or WeChat Channels managed by the same supervisor as the mini-program.
  3. The user who shares this WeChat Channels is the sharer for Weixin Mini Program.

Note: This interface requires base library version 2.22.1 above

# callback

Object res

attribute type Introductions
sharerOpenId string Sharer openid
promoter Promoter Extension Information

Object Promoter

attribute type Introductions
finderNickName string Username for the WeChat Channels of the promoter
promoterId string The only ID of the promoter
promoterOpenId string Openid

# Examples:

wx.getChannelsShareKey({
  success(res){
    var sharerOpenId = res.sharerOpenId
    var promoterInfo = res.promoter
  },
  fail(res) {
    console.log('getChannelsShareKey fail', res)
  }
})

# Create a new sharing card event

To receive a new shared card event, in addition to the conditions described by the wx.getChannelsShareKey () interface, you need to satisfy:

Weixin Mini Program Weixin Mini Program

# Example of request parameters

<ToUserName>gh_abcdefg</ToUserName> 
<FromUserName>1asdaf2141noejgeroig_0</FromUserName> 
<CreateTime>12344555555</CreateTime>
<MsgType>event</MsgType> 
<Event>miniprogram_sharer_action</Event>
<type>1</type>
<openid>ogewrgsragasrg</openid>
<promoter>
    <finder_nickname>XXXXXXXXXXXXXX</finder_nickname>
    <promoter_id>a-**************po</promoter_id>
    <promoter_openid>osagsadfasdfas</promoter_openid>
</promoter>

# Examples of back-up

success

# Dxplaination of request parameters

parameter type Introductions
ToUserName string Merchant Weixin Mini Program Name
FromUserName string Sender OpenID
CreateTime number Time of Event, Unix Timestamp
MsgType string Message type, fixed as event
Event string Event type, this interface is fixed to miniprogram_sharer_action
type number Types of shareholder actions, enumerable value: 1 - Shareholder share live rooms (generate share cards) 2 - Share merchandise cards 3 - Share window pages
openid string Sharer openid
promoter.finder_nickname string The nickname for the shared WeChat Channels
promoter.promoter_id string The unique ID for the shared WeChat Channels
promoter.promote_openid string The openid of the super administrator of the shared WeChat Channels

# Dxplaination of callback parameters

Simply return the character string success.

# Set Weixin Mini Program sharing mode

Used to change Weixin Mini Program sharing mode, Mini Programs default to use the sharer mode, you can change to use the sharing attribution mode.

Weixin Mini Program using the sharing attribution mode is not visible to the shareholders in the live-room shareholder function of the Mini Program league, and the WeChat side does not count and display the Mini Program's shareholder delivery data.

# Dxplaination of Interface Request Calls

http请求方式:POST
https://api.weixin.qq.com/shop/sharer/set_share_mode?access_token=xxxxxxxxx

# Dxplaination of request parameters

{
    "share_mode": 2
}

# Examples of back-up

{
    "errcode": 0,
    "errmsg": "ok"
}

# Dxplaination of request parameters

attribute type Introductions
sharer_mode number 1- Contributor 2- Share Attribution

# Dxplaination of callback parameters

attribute type Introductions
errcode number Common Error Code
errmsg string Error message

# Common Error Code

The enumeration value Introductions
0 Set up successfully
1310005 Changes are too frequent. The interval between changes must not be less than 30 days