seth-shi

seth-shi

Use WeChat Work to create a message push service bot

Start#

Previously, I configured message pushing in CODING after all project deployments were successful. As the number of projects increased, along with other services that also had message notifications, the service provided by Server 酱 was no longer sufficient.

I looked for two commonly used services, but both had limitations on the number of sends, which was not enough.

  • Server 酱 Free users can send 5 messages per day.
  • Qmsg 酱 Allows 30 messages per day, but is not stable enough.

Configuration#

  • I then saw that Server酱 had a tutorial on setting up a WeChat bot, repository address https://github.com/easychen/wecomchan.
  • Refer to the README to register for WeChat Work and create an organization (individual users can write as needed, no organization is required).
  • After obtaining the parameters (agentid, secret, Enterprise ID), you can directly send messages through the WeChat Work API.
  • Server酱 has encapsulated a service in Go, which can be directly deployed for use https://github.com/easychen/wecomchan/blob/main/go-wecomchan/README.md.
  • In CODING, replace the previous requests sent to Server酱 with your own built service.
// Server酱
 sshCommand(
  remote: remoteConfig,
  command: "curl -X POST -d \"title=`echo \$(curl -I 127.0.0.1:8199/ping)`&desp=Message details\" https://sctapi.ftqq.com/xxxx.send",
  sudo: true,
)
              
// After replacement, change it to what you need
sshCommand(
  remote: remoteConfig,
  command: "curl -X POST -d \"sendkey=xxxxxxx&msg_type=text&msg=${DOCKER_REPO_NAME}%0D%0A${SERVICE_URL}%0D%0A%0D%0A`echo \$(curl -I 127.0.0.1:8199/ping)`\" http://127.0.0.1:8080/wecomchan",
  sudo: true,
)

Effect Images#


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.