Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Send messages from the crowd with micro-machines-calls from AutoIT

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Foreword:

There are "swarm robots" in the WeChat group at work. If our business and operation and maintenance platform can directly push some information here, it must also be a good candidate channel.

I made a demo, and it looks like this in the PC version of WeCom:

What you see on the mobile phone looks like this:

My implementation process is divided into two steps:

Step 1: complete the basic add operation configuration in the enterprise micro:

According to the prompt, after filling in the name of the robot, it was successfully added:

Step 2: complete the relevant call.

We click "configuration instructions" in the above figure to successfully arrive at the configuration description page of the swarm robot in the enterprise APIs: https://work.weixin.qq.com/api/doc/90000/90136/91770?version=3.0.10.1202&platform=win

By looking at the official example, you can send a message to the enterprise micro group by executing the cmdline request http with the curl tool. this is simply too convenient. For some small and medium-sized enterprises, the operation and maintenance monitoring notification may not be all high-end Zabbix, and so on. It can be combined with some actual operation and maintenance platform in their own company after a small secondary development. To achieve the previous mail notification alarm, log alarm. It was also sent to WeCom on the way.

However, my unit used to develop and implement the operation and maintenance platform through the AUTOIT platform. I tried to find the "autoit swarm robot" on GOOGLE and Duniang to find the solution on the native Win platform without the help of curl tools. I had no choice but to write a test DEMO myself, hoping to give some reference to bloggers with similar platforms:

# Region#AccAu3Wrapper_Outfile=demo Robot Group messages-WeCom .exe # AccAu3Wrapper_UseUpx=y#AccAu3Wrapper_UseX64=n#AccAu3Wrapper_Res_Description= for more information: https://blog.51cto.com/boyhong#AccAu3Wrapper_Res_LegalCopyright=https://blog.51cto.com/boyhong#AccAu3Wrapper_Res_Language=2052#AccAu3Wrapper_Res_requestedExecutionLevel=requireAdministrator#AccAu3Wrapper_Antidecompile=y#EndRegion#include What information do you want to push and pass directly to the following variable $testmsg, you can pass $testmsg=@YEAR&' year'& @ MON&' month'& @ MDAY&' day'&'& @ HOUR&':'&@MIN&':'&@SEC&' lunch time\ n > people are iron rice or steel, and they are starving without eating.' Replace it with your KEY. On the page above where the swarm robot is added in the first step, there is $post_url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=d9xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9e'$post_data =' {'& @ LF&' "msgtype": "markdown",'& @ lf&' "markdown": {'& @ lf&' "content":'&'"& $testmsg&'" & @ lf&'}'& @ lf&'} 'Local $oErrorHandler = ObjEvent ("AutoIt.Error") "_ checkobj") Local $oHTTP= ObjCreate ("WinHttp.WinHttpRequest.5.1") $oHTTP.Open ("POST", $post_url, False) $oHTTP.setRequestHeader ("Content-Type", "application/json") $oHTTP.Send ($post_data) $data = $oHTTP.responseText$oHTTP= 0 Object is deleted If StringInStr ($data,'{"errcode": 44004, "errmsg') Then _ FileWriteLog (@ ScriptDir &"\ Example.log "," send failed because "& $data) ElseIf StringInStr ($data,'{" errcode ": 0," errmsg ":" ok "}') Then _ FileWriteLog (@ ScriptDir &"\ Example.log "," successfully sent, if not received Officially, there are 20 restrictions per minute and do not set the enterprise Weibo app to rest mode. ") EndIfExitFunc _ checkobj ($oError) _ FileWriteLog (@ ScriptDir &"\ Example.log ") "COM call error:" & "err.number is:" & "0x" & Hex ($oError.number) & "err.windescription:" & _ $oError.windescription & "err.description is:" & $oError.description & "err.source is:" & $oError.source & "err.scriptline is:" & $oError.scriptline & "err.retcode is:" & "0x" & Hex ($oError.retcode) EndFunc

Because it was only the demo research stage, then I added a few lines of code at a specified time to make a timed reminder like an alarm clock, hung it on my computer and ran it, and then saw the effect of the first two pictures above.

Conclusion

Isn't that interesting? With the help of this channel to achieve push information flow, there can be a lot of application scenarios. The rest is to integrate the core calling code into some platform interfaces. ^-^

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report