// appid
var appid = "1000005";
// 发送人,可以选人或者部门
var receiver = JSON.stringify({
"user": "XiaoXi"
});
// 文本类型的信息
var msg = JSON.stringify({
"msgType": "text",
"msgContent": {
"content": "测试发送信息"
}
});
// 发送图片类型的信息
msg = JSON.stringify({
"msgType": "image",
"msgContent": {
"media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY"
}
});
// 发送文本卡片
var msg = JSON.stringify({
"msgType": "textcard",
"msgContent": {
"title": "测试文本卡片",
"description": "看一看demo站点上的这个电子表格",
"url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
"btntxt": "打开报表"
}
});
// 发送markdown信息
var msg = JSON.stringify({
"msgType": "markdown",
"msgContent": {
"content": "#一级标题 \r\n##二级标题 \r\n**文字超链**:[简书](http://www.jianshu.com)"
}
});
// 发送图文消息
var msg = JSON.stringify({
"msgType": "news",
"msgContent": {
"articles":[
{
"title": "新闻1",
"description": "看一看demo站点上的这个电子表格",
"url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
"picurl": "https://pic.ntimg.cn/20110811/8029346_082444436000_2.jpg"
},{
"title": "新闻2",
"description": "11123格",
"url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
"picurl": "https://pic.quanjing.com/k6/67/QJ6278220913.jpg"
},{
"title": "新闻2",
"description": "3341212表格",
"url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
"picurl": "https://pic.quanjing.com/32/3g/QJ6107931496.jpg"
}
]
}
});
// 发送mpnews图文消息
var msg = JSON.stringify({
"msgType": "mpnews",
"msgContent": {
"articles":[
{
"title": "新闻1",
"thumb_media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY",
"author": "系统用户1",
"content": "<html><body><b>看一看demo站点上的这个电子表格</b></body></html>",
"content_source_url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
},{
"title": "新闻2",
"thumb_media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY",
"author": "系统用户2",
"content": "<html><body><b>看一看demo站点上的这个电子表格</b></body></html>",
"content_source_url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
},{
"title": "新闻3",
"thumb_media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY",
"author": "系统用户3",
"content": "<html><body><b>看一看demo站点上的这个电子表格</b></body></html>",
"content_source_url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
}
]
}
});
// 发送
connector.remoteInvoke("WeiXinModule", "sendAppMessage", [ appid, receiver, msg]);