<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/ DTD/wml_1.1.xml">

<wml>
<head>
<meta http-equiv="cache-control" content="max-age=180,private" />
</head>
<card title="新建微信通知中心(公测)">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">熊茂祥</a><br />时间:2021-02-03 13:01<br />分类:<a href="index.php?action=list&amp;cid=3&amp;hash=">ROS</a><br />标签:<a href="index.php?action=tags&amp;item=ros&amp;hash=">ros</a>, <a href="index.php?action=tags&amp;item=%E9%80%9A%E7%9F%A5&amp;hash=">通知</a>, <a href="index.php?action=tags&amp;item=%E5%BE%AE%E4%BF%A1&amp;hash=">微信</a>, <a href="index.php?action=tags&amp;item=%E5%91%8A%E8%AD%A6&amp;hash=">告警</a>, <a href="index.php?action=tags&amp;item=%E6%B6%88%E6%81%AF&amp;hash=">消息</a><br />内容:


由于ros使用各大邮箱发送邮件诸多限制和不便。本站为方便广大运维人员发送微信通知，特此设立微信转发接口。


本接口目前仅限于mikrotik系统接入。接入本接口代码可参考下面的脚本代码。



当前已支持的功能：

1.给微信好友发送通知。

2.给群发送通知。

3.获取群ID。（把通知中心微信拉入群后@通知中心发送&quot;获取群ID&quot;）

4.获取微信账号ID。(和通知中心微信发个消息即可)

5.自动同意添加好友和入群邀请。

6.支持中英文环境切换。

7.可自助下发指令，主动要求通知中心微信更新好友列表或群列表，直接发消息给通知中心的微信号即可。(新加的好友或群首次使用需要使用这个指令才能接收到消息)

8.可自助开关通知中心的消息。(好友和群均支持，命令帮助可私聊通知中心获取。)

9.支持接口调用结果回显，方便开发者调试。




限制：

1.每个IP每60分钟限制最多只能发送60条消息。(超过60次则会被关闭该微信ID接收的所有通知，直到自行发送开启通知命令。)

2.节点字符串不超过64个字符。

3.消息字符串不超过1800个字符。

4.仅允许ROS调用接口。

5.每个微信ID或者群每天仅允许发送100次通知。(超过120次则会被关闭该微信ID接收的所有通知，直到自行发送开启通知命令。)


 


脚本示例：




ROS脚本


    ###通知语言###(CN/EN)

    

    :local lang &quot;CN&quot;  

    ###通知微信ID或者群ID###  

    :local wxid &quot;ros6&quot;  

    ###通知节点名###  

    :local nodename &quot;你猜猜我是谁(8.8.8.8)&quot;  

    ###通知信息内容###  

    :local info &quot;我猜不到呀&quot;

    ###开启接口回显(yes/no)###

    :local debug &quot;no&quot;

    

    :do {/tool fetch url=(&quot;http://mail.ros6.com/wx/msg.php\?act=sendmsg&amp;wxid=$wxid&amp;node=$nodename&amp;msg=$info&amp;lang=$lang&quot;) mode=http keep-result=$debug dst-path=wx.log}

    :delay 3s;

    :if ([/file find name=&quot;wx.log&quot;] !=&quot;&quot;) do={:log warning [/file get  [find name=&quot;wx.log&quot;] contents];/file remove [find  name=&quot;wx.log&quot;]}







如果收不到通知，请确保有加通知中心的微信号为好友。目前内测阶段，可能随时爆炸，甚至取消项目。请做好心里准备。(BUG反馈联系微信:x9939781)














 





 


更新时间：2021/02/03


更新内容：微信通知允许管理员添加白名单，添加为白名单的ID和IP不受发送频率限制。
</p><p>
<a href="index.php?action=comments&amp;articleid=238&amp;hash=">查看评论</a><br />
<a href="index.php?action=login&amp;hash=">立即登陆发表评论</a><br />
</p>
<p><a href="index.php?action=list&amp;hash=">返回日志列表</a><br /><a href="index.php?action=index&amp;hash=">返回主页</a></p>
</card>
</wml>
