This sample illustrates the scenario of sending a Welcome note to a new external contact
One off authentication using corpid and corpsecret to retrieve access_token, which will be used in the subsequent API calls https://work.weixin.qq.com/api/doc/90000/90135/91039
This sample app include a Spring Boot microservices which provides an endpoint /corporate-customer-event for receiving callbacks.
In order to allow two-way communication between self-built applications and enterprise WeChat, enterprises can enable the receive message mode in the application management background. Enterprises that enable the message receiving mode need to provide the available message receiving server URL (https is recommended).
https://work.weixin.qq.com/api/doc/90000/90135/90237
- Login to [WeChat Work Admin - App Management]
- Follow these sequence to open
- Click "Create an app"
- Create an new app using your SID, choose the allowed users and click "Create an app"
- Click on the app that you have just created
- Click on "API enabled to receive messages"
- Specify the URL, Token and AES encryption key
- Enable all event types
- Click "Save"
Enterprise needs to provide
- token defined by enterprise for authenticating the event received from the message receiving URL
- AES Key for encrypting the message
From this API we can get the welcome_code for sending welcome note for the new customer
Require welcome_code https://work.weixin.qq.com/api/doc/90000/90135/92137
git clone https://github.com/jackycct/wechat-work-sample.git
If you are using Intellij for development, enable Lombok plugin https://projectlombok.org/setup/intellij
Enable port forward in your router from external URL to your callback service e.g. From External Port 8080 To Internal IP Address 192.186.1.123, port 8080
This page provides steps on how to perform port forwarding in major routers https://portforward.com/router.htm
e.g 220.246.105.20
Use your browser to access http://220.246.105.20:8080/ping
You should be able to see the "pong"