Use WeChat test account and enterprise WeChat application to build your own message push service. Just send a simple GET request to your own server to push the message to your mobile phone WeChat.
Before pushing, you need to configure WeChat-related settings on the system. Log in to the system backend (home page, http://你的域名/
), register a new user, and then refer to the following information for configuration.
You can configure only one of the WeChat test accounts and enterprise WeChat applications, but all fields must be filled in, otherwise push will not be possible.
GET http://你的域名/template/用户名
GET http://你的域名/template/用户名?token=hello
From: {{from.DATA}} {{description.DATA}} {{remark.DATA}}
. Get the template ID after submission. .http://你的域名/verify/用户名
; fill in any Token as the interface configuration Token. Do not click Verify after filling it out. First fill in the interface configuration Token in the push system and modify it successfully, then click Verify.Note: The enterprise WeChat application supports pushing to multiple enterprise members. For the recipient ID on the configuration page, fill in the member ID list (multiple recipients are separated by '|', up to 1000 are supported), or fill in "@all" to directly notify all Corporate members.
Simply send a simple GET or POST request to your own server to complete the push.
Note: All pushes must carry token
parameter to verify identity, and the value is the message push token in the user information configuration. You can use query params or form data in the URL.
WeChat test accounts only support template messages.
Push URL (GET/POST): http://你的域名/template/用户名
Optional parameter fields (used to appear in various places in the template):
Note: If you use GET request, all parameters need to be in the form of query params. If you use POST request, you need to use all form data.
Example: http://你的域名/template/用户名?token=token&from=webpage&desc=Hello%20Wrold&remark=这是一条测试消息
Effect:
The enterprise WeChat application supports plain text messages and text card messages.
Push URL (GET/POST): http://你的域名/plaintext/用户名
Required parameter fields:
Note: If you use GET request, all parameters need to be in the form of query params. If you use POST request, you need to use all form data.
Example: http://你的域名/plaintext/用户名?token=token&content=Hello,%20traveller
Push URL (GET/POST): http://你的域名/textcard/用户名
Required parameter fields:
Note: If you use GET request, all parameters need to be in the form of query params. If you use POST request, you need to use all form data.
Example: http://你的域名/textcard/用户名?token=token&title=Hello&desc=World
Effect:
Just run the packaged binary file directly. The first run will generate a configuration file, in which you can configure settings related to JWT issuance, whether to enable Redis as a cache (default no), and the port on which the service runs (default 80). It will take effect after restarting the program.
set GOPROXY= ` https://goproxy.cn,direct ` GOOS=windows GOARCH=amd64 | go build -o go-message.exe go-message-pusher
GOPROXY=https://goproxy.cn,direct CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o go-message go-message-pusher