seth-shi

seth-shi

Use WeChat Work to create a message push service robot.

Start#

Previously, I configured message push after the successful deployment of all projects on CODING. As the number of projects increased and other services also required message notifications, the services provided by Server 酱 were not enough.

I looked for two commonly used services, but both have limitations on the number of times they can be used, which is not enough.

  • Server 酱 allows free users to send 5 messages per day.
  • Qmsg 酱 allows 30 messages per day, but it is not stable enough.

Configuration#

  • Later, I found a tutorial on how to build a WeChat robot using Server酱. The repository address is https://github.com/easychen/wecomchan.
  • Follow the instructions in the README to register WeChat Work and create a company (for personal users, you can write as needed, no need for a company).
  • After obtaining the parameters (agentid, secret, corporate ID), you can directly send messages through the WeChat Work API.
  • Server酱 has encapsulated a service in Go, which can be directly deployed and used. The documentation is available at https://github.com/easychen/wecomchan/blob/main/go-wecomchan/README.md.
  • In CODING, replace the previous requests sent to Server酱 with your own deployed 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 your own as needed
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,
)

Screenshots#


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