steedos-platform
steedos-platform copied to clipboard
添加通知触发器或者其他方式的自定义通知——微信通知
鉴于通知的两个主要方式, 网站站内通知,需要开启浏览器并保持界面, 客户端通知,需要下载客户端,
如果用户都关注了企业微信,可以在微信客户端收到企业微信应用的主动推送的消息,并且没有时间和数量的限制, 目前可以在自定义对象触发消息推送,但是系统对象通知的内容如何自定义通知事件处理
可以参考企业微信通知的代码,加一个插件。
或许可以把这个归到自动化操作中,目前流程自动化只有字段更新,可以加个类似触发器的自定义处理脚本
如果用户都关注了企业微信,可以在微信客户端收到企业微信应用的主动推送的消息,并且没有时间和数量的限制.
@Blame4 有具体的教程或者示例吗?
文档:https://developer.work.weixin.qq.com/document/path/90236 我使用的是应用消息,需要用户关注企业微信,可以在普通微信客户端收到主动推送, node red 的示例: 替换 __CORPID__ to corpid __CORPSECRET__ to corpsecret __USERID__ to userid __AGENTID__ to agentid
[ { "id": "7c6c5c5821328375", "type": "subflow", "name": "发送消息1", "info": "", "category": "", "in": [ { "x": 60, "y": 80, "wires": [ { "id": "c7c5bc438d0568ae" } ] } ], "out": [ { "x": 520, "y": 80, "wires": [ { "id": "d6032e60864b686a", "port": 0 } ] } ], "env": [], "meta": {}, "color": "#DDAA99" }, { "id": "c7c5bc438d0568ae", "type": "function", "z": "7c6c5c5821328375", "name": "发送消息1", "func": "let url = \"https://qyapi.weixin.qq.com/cgi-bin/message/send\";\nconst auth = msg.payload.access_token;\nurl +=
?access_token=${auth};\n\n\nmsg.url = url;\nmsg.payload = msg.data;\ndelete msg.data;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 200, "y": 80, "wires": [ [ "d6032e60864b686a" ] ] }, { "id": "d6032e60864b686a", "type": "http request", "z": "7c6c5c5821328375", "name": "", "method": "POST", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": true, "proxy": "", "authType": "", "senderr": false, "x": 380, "y": 80, "wires": [ [] ] }, { "id": "ee931b61c0f00ff3", "type": "subflow", "name": "企业微信获取token1", "info": "", "category": "", "in": [ { "x": 60, "y": 100, "wires": [ { "id": "5f627827b2e5f512" } ] } ], "out": [ { "x": 660, "y": 100, "wires": [ { "id": "7474f2397cf5257b", "port": 0 } ] } ], "env": [], "meta": {}, "color": "#DDAA99" }, { "id": "7474f2397cf5257b", "type": "http request", "z": "ee931b61c0f00ff3", "name": "", "method": "GET", "ret": "obj", "paytoqs": "query", "url": "https://qyapi.weixin.qq.com/cgi-bin/gettoken", "tls": "", "persist": false, "proxy": "", "authType": "", "senderr": false, "x": 480, "y": 100, "wires": [ [] ] }, { "id": "5f627827b2e5f512", "type": "change", "z": "ee931b61c0f00ff3", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"corpid\":\"__CORPID__\",\"corpsecret\":\"__CORPSECRET__\"}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 270, "y": 100, "wires": [ [ "7474f2397cf5257b" ] ] }, { "id": "2141a163db4ac95a", "type": "subflow:ee931b61c0f00ff3", "z": "58430468242552d3", "name": "", "x": 2210, "y": 1320, "wires": [ [ "831eb243cf0b2f7f" ] ] }, { "id": "4c171e01622b888a", "type": "subflow:7c6c5c5821328375", "z": "58430468242552d3", "name": "", "x": 2740, "y": 1320, "wires": [ [ "6544b11017313ec1" ] ] }, { "id": "831eb243cf0b2f7f", "type": "function", "z": "58430468242552d3", "name": "", "func": "const touser = \"__USERID__\";\nconst agentid = __AGENTID__;\nconst message = {\n \"touser\":
${touser},\n \"msgtype\": \"textcard\",\n \"agentid\": agentid,\n \"textcard\": {\n \"title\": \"领奖通知\",\n \"description\": \"<div class=\\\"gray\\\">2016年9月26日</div> <div class=\\\"normal\\\">恭喜你抽中iPhone 7一台,领奖码:xxxx</div><div class=\\\"highlight\\\">请于2016年10月10日前联系行政同事领取</div>\",\n \"url\": \"URL\",\n \"btntxt\": \"更多\"\n },\n \"enable_id_trans\": 0,\n \"enable_duplicate_check\": 0,\n \"duplicate_check_interval\": 1800\n};\nmsg.data = message;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2490, "y": 1320, "wires": [ [ "4c171e01622b888a" ] ] }, { "id": "42e99ffef0ceb301", "type": "inject", "z": "58430468242552d3", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 1930, "y": 1320, "wires": [ [ "2141a163db4ac95a" ] ] }, { "id": "6544b11017313ec1", "type": "debug", "z": "58430468242552d3", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 2990, "y": 1320, "wires": [] } ]