go-wecomchan.yml

 

2023-07-14

通过企业微信向微信推送消息,Docker Compose 配置文件:

1
version: '3'
2
3
services:
4
5
go-wecomchan:
6
image: docker.io/aozakiaoko/go-wecomchan:latest
7
environment:
8
- SENDKEY=发送时用来验证的key 自定义
9
- WECOM_CID=企业微信公司ID
10
- WECOM_SECRET=企业微信应用Secret
11
- WECOM_AID=企业微信应用ID
12
- WECOM_TOUID=@all
13
- REDIS_STAT=ON
14
- REDIS_ADDR=redis:6379
15
- REDIS_PASSWORD=redis的连接密码
16
ports:
17
- 8080:8080
18
networks:
19
- go-wecomchan
20
depends_on:
21
- redis
22
23
redis:
24
image: bitnami/redis:6.2
25
environment:
26
- REDIS_PASSWORD=redis的连接密码
27
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
28
networks:
29
- go-wecomchan
30
volumes:
31
- /data/redis:/bitnami/redis/data
32
33
volumes:
34
redis_data:
35
driver: local
36
37
networks:
38
go-wecomchan:

测试

Terminal window
1
# 推送文本消息
2
curl --location --request GET 'http://localhost:8080/wecomchan?sendkey={你的sendkey}&msg={你的文本消息}&msg_type=text'
3
4
# 推送图片消息
5
curl --location --request POST 'http://localhost:8080/wecomchan?sendkey={你的sendkey}&msg_type=image' \
6
--form 'media=@"test.jpg"'