# wx.miniapp.shareMiniProgramMessage

Share Mini Program Cards to WeChat

Note:

1, the interface needs to apply and initialize WeChat open Capabilities, requires the client to configure the relevant

2, the interface does not support theMobile App AssistantDebugging, developers need to build Apk or ipa Install to the phone before debugging

# Precautions before Access

# parameter

Easy for developers to understand, wx.miniapageshareMiniProgramMessage Parameters andWeChat Open Platform opensdk Sharing interfaceConsistent parameters

attribute type Default value Required Introductions
userName string - yes Mini Program original ID, such as gh_d43f693ca31f,[Click to see how to get it](https://dev.weixin.qq.com/docs/framework/faq/dev.html#_1, how to get the Mini Program original -id)
path string - yes Mini Program page pathFor small games, you can just pass in query Part, to achieve the effect of passing parameters, such as: incoming "?foo=bar"
title string - yes Video Title
description string - yes Video Description
imagePath string - yes Share thumbnails related to Mini Program, support code package image resource path or local temporary, cache, user fileGraph of a network is not supported
webpageUrl string - yes Compatible with lower versions of web links url
withShareTicket string - yes Usually developers want to share the Mini Program to be opened a second time to get more information, such as the group identity. Can be set withShareTicket for True, when the sharing card is opened by other users in a group chat, you can get the ShareTicket, for more sharing information. See Mini Program for more information. , Minimum Client Version Requirements: 6.5.13
MiniprogramType number - yes 0 - Official, 1 - Development, 2 - Experience
scene number - yes Send the target scene, only support the session, 0 = share to the session

Note: Initiated to share App Belong to the same WeChat Open Platform account as the Mini Program (that is, you need to put the Mini Appid Bound to theWeChat Open Platform - Management Centre - Mini Program), more notes can be found in the WeChat Open Platform Mobile Application Documentation.

# JSAPI Examples of code

wx.miniapp.shareMiniProgramMessage({
    // Note: Mini Program original id Not a Mini Program. Appid, usually gh_xxx  What's at the beginning, Such as gh_d43f693ca31f  
    userName: 'Mini Program original id ',  
    path: 'pages/index/index',
    imagePath: '/pages/thumb.png',
    WebpageUrl:  'www.qq.com',
    withShareTicket: true,
    MiniprogramType:  0,
    scene: 0, 
    success(res) {
    wx.showToast({
        title: "Success: Sharing Small Programs,"
    })
    console.log(res)
    },
    fail() {
    wx.showToast({
        title: "Failure: Sharing Small Programs,"
    })
    }
})

 <!-- 该文档系机器翻译完成 -->