This is a creation in Article, where the information may have evolved or changed.
WeChat SDK for Go
The SDK developed with Golang is simple and easy to use.
Project Address: Https://github.com/silenceper/wechat
Document Address: Docs
Quick Start
Here is an example of handling message reception and reply:
Configuration parameters
Config: = &wechat. config{
AppID: "xxxx",
Appsecret: "xxxx",
Token: "xxxx",
Encodingaeskey: "xxxx",
Cache:memcache
}
WC: = WeChat. Newwechat (config)
Incoming request and Responsewriter
Server: = WC. Getserver (Request, Responsewriter)
Server. Setmessagehandler (func (MSG message). Mixmessage) *message. Reply {
Reply message: Demo reply message sent by user
Text: = message. NewText (Msg. Content)
Return &message. Reply{message. Msgtext, text}
})
Server. Serve ()
Server. Send ()
Complete code: EXAMPLES/HTTP/HTTP.GO
Document Address: HTTPS://GITHUB.COM/SILENCEPER/WECHAT/BLOB/MASTER/README.MD