Question
Is there a way to provide a custom title, description and thumbnail for when my website pages are shared from within WeChat?
Actually right now WeChat does provide iOS/Andriod SDK for share content in Moments or with friend, and here is the English documentation for that: http://dev.wechat.com/wechatapi/messages-moments
[Not working since WeChat published the new JS SDK] This is solution form WeChat: http://mp.weixin.qq.com/qa/index.php?qa=3163 However, there are all Chinese. The code you could try is below:
var imgUrl = 'http://xxx/your-share-icon.png';
var lineLink = 'http://xxx/your-share-link';
var descContent = "your-content-desc";
var shareTitle = 'you-share-title';
var appid = 'your-app-id (from WeChat)';
function shareFriend() {
WeixinJSBridge.invoke('sendAppMessage',{
"appid": appid,
"img_url": imgUrl,
"img_width": "640",
"img_height": "640",
"link": lineLink,
"desc": descContent,
"title": shareTitle
}, function(res) {
_report('send_msg', res.err_msg);
})
}
function shareTimeline() {
WeixinJSBridge.invoke('shareTimeline',{
"img_url": imgUrl,
"img_width": "640",
"img_height": "640",
"link": lineLink,
"desc": descContent,
"title": shareTitle
}, function(res) {
_report('timeline', res.err_msg);
});
}
function shareWeibo() {
WeixinJSBridge.invoke('shareWeibo',{
"content": descContent,
"url": lineLink,
}, function(res) {
_report('weibo', res.err_msg);
});
}
// WeChat browser will initial by above function and trigger WeixinJSBridgeReady event.
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
// share to friend
WeixinJSBridge.on('menu:share:appmessage', function(argv){
shareFriend();
});
// share to timeline
WeixinJSBridge.on('menu:share:timeline', function(argv){
shareTimeline();
});
// share to weibo
WeixinJSBridge.on('menu:share:weibo', function(argv){
shareWeibo();
});
}, false);