<?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="Telegram通知中心(下架)">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">熊茂祥</a><br />时间:2024-07-07 09:16<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=telegram&amp;hash=">telegram</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使用各大邮箱发送邮件诸多限制和不便。本站为方便广大运维人员发送Telegram通知，特此设立Telegram转发接口。


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


当前已支持的功能：

1.给Telegram好友发送通知。


2.给Telegram群发送通知。


 3.获取Telegram账号ID。(和通知中心Telegram发送&quot;/获取chatid&quot;)


4.获取Telegram群ID。(@通知中心Telegram发送&quot;/获取chatid&quot;，必须将其设置为群管理员方可正常调用。)

5.支持中英文环境切换。

6.可自助开关通知中心的消息。(命令帮助可私聊通知中心发送&quot;/帮助&quot;获取。)

7.支持接口调用结果回显，方便开发者调试。

8.支持IP白名单，不受发送通知频率限制。


 


限制：

1.每个IP每60分钟限制最多只能发送120条消息。(超过120次则会忽略发送通知，直至每小时小于120次的发送频率自动解除封锁。)

2.节点字符串不超过64个字符。

3.消息字符串不超过500个字符。

4.仅允许ROS调用接口。

5.每个Telegram账号或群每天仅允许发送1000次通知。(超过1000次则会被关闭该Telegram账号或群接收的所有通知，直到自行发送开启通知命令。)




注意：如发送内容包含空格，请用&quot;%20&quot;来替换。



由于Telegram性质特殊，不提供技术支持，仅接受报障和BUG修复。(BUG反馈和报障联系微信:x9939781)



Telegram通知中心账号为:@ROS6_bot

请添加后再发送消息&quot;/获取chatid&quot;设置到脚本。




ROS脚本


    ###通知语言###(CN/EN)  

    :local lang &quot;CN&quot;  

    ###服务器入口(8.209.99.243德国)###  

    :local serverip &quot;8.209.99.243&quot;  

    ###通知微信ID或者群ID###  

    :local chatid &quot;-353610774&quot;  

    ###通知节点名###  

    :local nodename &quot;猜猜我是谁(8.8.8.8)&quot;  

    ###通知信息内容###  

    :local info &quot;坑爹的golang&quot;  

    ###开启接口回显(yes/no)###  

    :local debug &quot;yes&quot;  

    :do {/tool fetch url=(&quot;https://$serverip:8443/chatid=$chatid&amp;node=$nodename&amp;msg=$info&amp;lang=$lang&quot;) mode=https check-certificate=no keep-result=$debug dst-path=tg.log}  

    :delay 3s;  

    :if ([/file find name=&quot;tg.log&quot;] !=&quot;&quot;) do={:log warning [/file get [find name=&quot;tg.log&quot;] contents];/file remove [find name=&quot;tg.log&quot;]}  









 


 展示图如下：














更新时间：2024.07.07

更新内容：服务器计划于2024年7月23日下架，请大家尽快迁移，本站不作数据留存，到期后将清空所有服务器数据。









更新时间：2021.2.17

更新内容：修正了当发送消息内容开头字符串为H时无法成功发送消息的BUG。







更新时间：2020.11.16

更新内容：节点字符串调整最大支持64个字符，消息字符串调整最大支持500个字符。
</p><p>
<a href="index.php?action=comments&amp;articleid=240&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>
