Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bububa/weworkfinancesdk
WeWorkFinanceSDK golang version
https://github.com/bububa/weworkfinancesdk
finance sdk wechat work
Last synced: about 5 hours ago
JSON representation
WeWorkFinanceSDK golang version
- Host: GitHub
- URL: https://github.com/bububa/weworkfinancesdk
- Owner: bububa
- License: gpl-3.0
- Created: 2020-08-15T14:22:29.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-16T05:34:08.000Z (7 months ago)
- Last Synced: 2024-06-20T06:29:48.693Z (5 months ago)
- Topics: finance, sdk, wechat, work
- Language: Go
- Homepage:
- Size: 4.73 MB
- Stars: 15
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 企业微信会话内容存档SDK golang版
[![Go Reference](https://pkg.go.dev/badge/github.com/bububa/WeWorkFinanceSDK.svg)](https://pkg.go.dev/github.com/bububa/WeWorkFinanceSDK)
[![Go](https://github.com/bububa/WeWorkFinanceSDK/actions/workflows/go.yml/badge.svg)](https://github.com/bububa/WeWorkFinanceSDK/actions/workflows/go.yml)
[![goreleaser](https://github.com/bububa/WeWorkFinanceSDK/actions/workflows/goreleaser.yml/badge.svg)](https://github.com/bububa/WeWorkFinanceSDK/actions/workflows/goreleaser.yml)
[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/bububa/WeWorkFinanceSDK.svg)](https://github.com/bububa/WeWorkFinanceSDK)
[![GoReportCard](https://goreportcard.com/badge/github.com/bububa/WeWorkFinanceSDK)](https://goreportcard.com/report/github.com/bububa/WeWorkFinanceSDK)
[![GitHub license](https://img.shields.io/github/license/bububa/WeWorkFinanceSDK.svg)](https://github.com/bububa/WeWorkFinanceSDK/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/bububa/WeWorkFinanceSDK.svg)](https://GitHub.com/bububa/WeWorkFinanceSDK/releases/)用于拉取企业聊天记录与媒体消息,该SDK是对官方linux c库的封装
## Usage
```golang
package mainimport (
"log"
"fmt"
"bytes"sdk "github.com/bububa/WeWorkFinanceSDK"
)func main() {
corpId := "企业ID"
corpSecret := "secret"
clt, err := sdk.NewClient(corpId, corpSecret)
if err != nil {
log.Fatalln(err)
}
defer clt.Destroy()
var (
seq uint64
limit uint64 = 1000
proxy = ""
passwd = ""
timeout = 300
)
for {
chatsData, err := clt.GetChatData(seq, limit, proxy, passwd, timeout)
if err != nil {
log.Fatalln(err)
}
if len(chatsData) == 0 {
break
}
// iterate chatsData
for _, data := range chatsData {
// update seq with chatdata.Seq for next loop
seq = data.Seq
// decrypt chat data
msg, err := clt.DecryptData(data.EncryptRandomKey, data.EncryptChatMsg)
if err != nil {
log.Fatalln(err)
continue
}
fmt.Printf("msg: %+v\n", msg)
if msg.MessageType() == sdk.IMG_MSG {
var (
w = new(bytes.Buffer)
sdkField = msg.(sdk.ImageMessage).SdkFileId
)
err := clt.DownloadMedia(w, sdkField, proxy, passwd, timeout)
if err != nil {
log.Fatalln(err)
continue
}
log.Printf("download mediadata, len:%d bytes\n", w.Len())
}
}
}
}
```## Reference
[企业微信获取会话内容文档](https://work.weixin.qq.com/api/doc/90000/90135/91774)