This project needs your help!
import (
"github.com/xen0n/go-workwx/v2" // package workwx
)
A Work Weixin (aka Wechat Work) client SDK for Golang, that happens to be battle-tested and pretty serious about its types.
In production since late 2018, pushing all kinds of notifications and alerts in at least 2 of Qiniu's internal systems.
A Golang enterprise WeChat client SDK; I happen to have tried it in a production environment and am very serious about types.
Since the end of 2018, at least two internal systems in Qiniu have been running to this day, pushing various notifications and alarms.
English translation TODO for now, as the service covered here is not available outside of China (AFAIK).
Warning
The v2 version of this library may still have incompatible API changes, such as adjustments to field names, method names, etc. Please note. There won't be a v2 version of the tag until we've taken care of all the known corners.
If you rely on this library, please reply to the v2 version tracking ticket or make an emoticon reaction to show your attitude! The author now maintains this project entirely in his spare time and really needs your feedback.
I need to use Go to implement a simple message push at work, and I thought about finding an open source library. However, the code quality of the only existing open source enterprise WeChat Golang SDK is poor. I had to write one myself.
Update : It has been a long time since this library was written; now (2019.08) there are three or four similar projects. However, after looking at these "competing products", I found that the type design, public interface, access token processing, etc. of my library are not bad. Why do people always like to hard-code Host
requests, use global variables, unpack for the sake of unpacking, and even expose internal methods?
The v2.x branch of this library supports at least the last stable version of Go, which is currently go1.19. If you need to use it with an earlier version of Go, please move to the v1.x version. The code there still supports at least go1.17.
CI will run tests on the current stable version of Go and the previous stable version. Only when all tests pass can the PR be merged.
Note: As Go upstream continues to evolve, we need to be able to ensure that we can catch up relatively cheaply. If go.mod
specifies that the Go version is relatively low, which will hinder the project's own functional iteration or reconstruction, we will not specifically consider locking downstream users of the Go version to slow down very necessary upgrades. If you still have such needs, please file an issue for communication.
Host
, which can be used to block a layer of gateways, temporary debugging and other strange needs.http.Client
WorkwxApp
object is constructed in two steps, and then used directlylowlevel
package may be made to expose the bare API interface, but it is likely not to be done.UserInfo
, Recipient
) to encourage the idiomatic Go stylepanic
at the slightest disagreement. The few existing situations need to be repaired.workwxctl
command line gadget to help debuggingFor details, see the godoc document. Examples are also provided for reference.
Markdown and other types of messages currently do not support sending as confidential messages, and an error will be reported if forced to send. So why do all methods of sending messages carry the isSafe
parameter?
On the one hand, the enterprise WeChat service provider is entirely likely to support the confidential sending of more message types in the future, and does not want the client code to be recompiled at that time; on the other hand, the response will report an error anyway, and you will not keep this logic. Therefore it will not be changed.