wechat work go
1.0.0
import (
wechatwork "github.com/dfang/wechat-work-go" // package wechatwork
)
[✓] Member Management
[✓] Department Management
tag management
Asynchronous batch interface
Address book callback notification
Enterprise WeChat is divided into applications. There are multiple apps in one enterprise (one corpid) (corresponding to a set of corpsecret, agentid)
So when using it, first create an enterprise client, and then use this client to create different app objects.
import (
wechatwork "github.com/dfang/wechat-work-go" // package wechatwork
)
corpID := os . Getenv ( "CORP_ID" )
corpSecret := os . Getenv ( "CORP_SECRET" )
agentID , _ := strconv . ParseInt ( os . Getenv ( "AGENT_ID" ), 10 , 64 )
corp := wechatwork . New ( corpID )
app = corp . NewApp ( corpSecret , agentID )
To use the function of which module, create an instance of that module
import "github.com/dfang/wechat-work-go/message"
msg := message.WithApp(app)
msg.SendAppChatMessage(....)
Refer to the API documentation, run tests, and quickly understand the API
export CORP_ID=xxxxxx
export CORP_SECRET=yyyyyy
export AGENT_ID=zzzzzz
运行单个测试,比如只运行access_token_test.go的测试
ginkgo -v -focus='access_token'
或者
go test -v wechat_work_go_suite_test.go client_test.go
watch mode
ginkgo watch -v -focus='access_token*'