Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
xen0n committed Dec 14, 2022
2 parents 7f33c99 + 07b43fe commit bdb5402
Show file tree
Hide file tree
Showing 22 changed files with 1,547 additions and 135 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
uses: golangci/golangci-lint-action@v3.3.1
with:
version: v1.45
version: v1.50
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ in at least 2 of Qiniu's internal systems.
## Supported APIs

* [x] 通讯录管理 (**部分支持**,见下)
* [ ] 客户联系
* [x] 客户联系 (**大部分支持**,见下)
* [ ] 应用管理
* [x] 消息发送 (除修改群聊会话外全部支持)
* [x] 消息接收 (**接口尚不稳定,极有可能做出不兼容改动,先不要用**)
* [x] 消息接收
* [x] 素材管理 (**支持上传**, 见下)
* [ ] OA
* [ ] 会话内容存档
* [x] OA (**大部分支持**,见下)
* [x] 会话内容存档 (**大部分支持**,见下)
* [x] 企业微信登录接口 (code2Session)

<details>
Expand Down Expand Up @@ -152,6 +152,11 @@ in at least 2 of Qiniu's internal systems.
- [x] 删除跟进成员事件
- [x] 客户接替失败事件
- [x] 客户群变更事件
* [x] 消息推送
- [x] 创建企业群发
- [ ] 获取企业的全部群发记录
- [ ] 发送新客户欢迎语
- [ ] 入群欢迎语素材管理

</details>

Expand Down
44 changes: 43 additions & 1 deletion apis.md.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 26 additions & 3 deletions appchat.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package workwx

// CreateAppchat 创建群聊会话
func (c *WorkwxApp) CreateAppchat(chatInfo *ChatInfo) (chatid string, err error) {
func (c *WorkwxApp) CreateAppchat(chatInfo *ChatInfo) (chatID string, err error) {
resp, err := c.execAppchatCreate(reqAppchatCreate{
ChatInfo: chatInfo,
})
Expand All @@ -12,9 +12,9 @@ func (c *WorkwxApp) CreateAppchat(chatInfo *ChatInfo) (chatid string, err error)
}

// GetAppchat 获取群聊会话
func (c *WorkwxApp) GetAppchat(chatid string) (*ChatInfo, error) {
func (c *WorkwxApp) GetAppchat(chatID string) (*ChatInfo, error) {
resp, err := c.execAppchatGet(reqAppchatGet{
ChatID: chatid,
ChatID: chatID,
})
if err != nil {
return nil, err
Expand All @@ -24,3 +24,26 @@ func (c *WorkwxApp) GetAppchat(chatid string) (*ChatInfo, error) {
obj := resp.ChatInfo
return obj, nil
}

// GetAppChatList 获取客户群列表
func (c *WorkwxApp) GetAppChatList(req ReqChatList) (*RespAppchatList, error) {
resp, err := c.execAppchatListGet(reqAppchatList{
ReqChatList: req,
})
if err != nil {
return nil, err
}
return resp.RespAppchatList, nil
}

// GetAppChatInfo 获取客户群详细信息
func (c *WorkwxApp) GetAppChatInfo(chatID string) (*RespAppChatInfo, error) {
resp, err := c.execAppchatInfoGet(reqAppchatInfo{
ChatID: chatID,
NeedName: ChatNeedName,
})
if err != nil {
return nil, err
}
return resp.GroupChat, nil
}
87 changes: 87 additions & 0 deletions chat_info.md.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/workwxctl/commands/cmd_appchat_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

func cmdAppchatGet(c *cli.Context) error {
cfg := mustGetConfig(c)
chatid := c.Args().Get(0)
chatID := c.Args().Get(0)

app := cfg.MakeWorkwxApp()
// TODO: failed requests currently panics
info, err := app.GetAppchat(chatid)
info, err := app.GetAppchat(chatID)

if err != nil {
fmt.Printf("error = %+v\n", err)
Expand Down
11 changes: 10 additions & 1 deletion docs/apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Name|Request Type|Response Type|Access Token|URL|Doc
Name|Request Type|Response Type|Access Token|URL|Doc
:---|------------|-------------|------------|:--|:--
`execExternalContactListCorpTags`|`reqExternalContactListCorpTags`|`respExternalContactListCorpTags`|+|`POST /cgi-bin/externalcontact/get_corp_tag_list`|[获取企业标签库](https://work.weixin.qq.com/api/doc/90000/90135/92117)
`execExternalContactAddCorpTag`|`reqExternalContactAddCorpTag`|`respExternalContactAddCorpTag`|+|`POST /cgi-bin/externalcontact/add_corp_tag`|[添加企业客户标签](https://work.weixin.qq.com/api/doc/90000/90135/92117)
`execExternalContactAddCorpTag`|`reqExternalContactAddCorpTagGroup`|`respExternalContactAddCorpTag`|+|`POST /cgi-bin/externalcontact/add_corp_tag`|[添加企业客户标签](https://work.weixin.qq.com/api/doc/90000/90135/92117)
`execExternalContactEditCorpTag`|`reqExternalContactEditCorpTag`|`respExternalContactEditCorpTag`|+|`POST /cgi-bin/externalcontact/edit_corp_tag`|[编辑企业客户标签](https://work.weixin.qq.com/api/doc/90000/90135/92117)
`execExternalContactDelCorpTag`|`reqExternalContactDelCorpTag`|`respExternalContactDelCorpTag`|+|`POST /cgi-bin/externalcontact/del_corp_tag`|[删除企业客户标签](https://work.weixin.qq.com/api/doc/90000/90135/92117)
`execExternalContactMarkTag`|`reqExternalContactMarkTag`|`respExternalContactMarkTag`|+|`POST /cgi-bin/externalcontact/mark_tag`|[标记客户企业标签](https://work.weixin.qq.com/api/doc/90000/90135/92118)
Expand Down Expand Up @@ -127,6 +127,8 @@ Name|Request Type|Response Type|Access Token|URL|Doc

Name|Request Type|Response Type|Access Token|URL|Doc
:---|------------|-------------|------------|:--|:--
`execAppchatListGet`|`reqAppchatList`|`respAppchatList`|+|`POST /cgi-bin/externalcontact/groupchat/list`|[获取客户群列表](https://developer.work.weixin.qq.com/document/path/92120)
`execAppchatInfoGet`|`reqAppchatInfo`|`respAppchatInfo`|+|`POST /cgi-bin/externalcontact/groupchat/get`|[获取客户群详细](https://developer.work.weixin.qq.com/document/path/92122)
`execAppchatCreate`|`reqAppchatCreate`|`respAppchatCreate`|+|`POST /cgi-bin/appchat/create`|[创建群聊会话](https://work.weixin.qq.com/api/doc#90000/90135/90245)
`execAppchatUpdate`|TODO|TODO|+|`POST /cgi-bin/appchat/update`|[修改群聊会话](https://work.weixin.qq.com/api/doc#90000/90135/90246)
`execAppchatGet`|`reqAppchatGet`|`respAppchatGet`|+|`GET /cgi-bin/appchat/get`|[获取群聊会话](https://work.weixin.qq.com/api/doc#90000/90135/90247)
Expand Down Expand Up @@ -211,3 +213,10 @@ Name|Request Type|Response Type|Access Token|URL|Doc
:---|------------|-------------|------------|:--|:--
`execTransferResignedCustomer`|`reqTransferCustomer`|`respTransferCustomer`|+|`POST /cgi-bin/externalcontact/resigned/transfer_customer`|[离职继承 分配离职成员的客户](https://developer.work.weixin.qq.com/document/path/94081)
`execGetTransferResignedCustomerResult`|`reqGetTransferCustomerResult`|`respGetTransferCustomerResult`|+|`POST /cgi-bin/externalcontact/resigned/transfer_result`|[离职继承 查询客户接替状态](https://developer.work.weixin.qq.com/document/path/94082)

# 客户联系-消息推送

## API calls
Name|Request Type|Response Type|Access Token|URL|Doc
:---|------------|-------------|------------|:--|:--
`execAddMsgTemplate`|`reqAddMsgTemplateExternalContact`|`respAddMsgTemplateExternalContact`|+|`POST /cgi-bin/externalcontact/add_msg_template`|[创建企业群发](https://developer.work.weixin.qq.com/document/path/92135)
70 changes: 70 additions & 0 deletions docs/chat_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,73 @@ Name|JSON|Type|Doc
`Name`|`name`|`string`|群聊名
`OwnerUserID`|`owner`|`string`|群主id
`MemberUserIDs`|`userlist`|`[]string`|群成员id列表

### `ReqChatListOwnerFilter` 群主过滤

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserIDList`|`userid_list`|`[]string`| 用户ID列表。最多100个

### `ReqChatList` 获取客户群列表参数

Name|JSON|Type|Doc
:---|:---|:---|:--
`StatusFilter`|`status_filter`|`int64`| 客户群跟进状态过滤
`OwnerFilter`|`owner_filter`|`ReqChatListOwnerFilter`| 群主过滤
`Cursor`|`cursor`|`string`| 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用不填
`Limit`|`limit`|`int64`| 分页,预期请求的数据量,取值范围 1 ~ 1000

### `RespGroupChatList` 客户群列表数据

Name|JSON|Type|Doc
:---|:---|:---|:--
`ChatID`|`chat_id`|`string`| 客户群ID
`Status`|`status`|`int64`| 客户群跟进状态 0 - 跟进人正常 1 - 跟进人离职 2 - 离职继承中 3 - 离职继承完成

### `RespAppchatList` 客户群列表结果

Name|JSON|Type|Doc
:---|:---|:---|:--
`GroupChatList`|`group_chat_list`|`[]RespGroupChatList`| 客户群列表
`NextCursor`|`next_cursor`|`string`| 分页游标

### `ChatMemberList` 客户群成员列表

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 群成员ID
`Type`|`type`|`int64`| 群成员类型 1 - 企业成员 2 - 外部联系人
`UnionID`|`unionid`|`string`| 微信unionid
`JoinTime`|`join_time`|`int64`| 入群时间
`JoinScene`|`join_scene`|`int64`| 入群方式。1 - 由群成员邀请入群(直接邀请入群)2 - 由群成员邀请入群(通过邀请链接入群)3 - 通过扫描群二维码入群
`Invitor`|`invitor`|`ChatMemberListInvitor`| 邀请者。目前仅当是由本企业内部成员邀请入群时会返回该值
`GroupNickname`|`group_nickname`|`string`| 在群里的昵称
`Name`|`name`|`string`| 在群里名字

### `ChatMemberListInvitor` 入群邀请者

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 邀请者ID

### `ChatAdminList` 客户群管理员列表

Name|JSON|Type|Doc
:---|:---|:---|:--
`UserID`|`userid`|`string`| 管理员ID

### `RespAppChatInfo` 客户群详情
Name|JSON|Type|Doc
:---|:---|:---|:--
`ChatID`|`chat_id`|`string`| 客户群ID
`Name`|`name`|`string`| 客户群名称
`Owner`|`owner`|`string`| 群主ID
`CreateTime`|`create_time`|`int64`| 群创建时间
`Notice`|`notice`|`string`| 群公告
`MemberList`|`member_list`|`[]*ChatMemberList`| 群成员列表
`AdminList`|`admin_list`|`[]*ChatAdminList`| 群管理员列表

```go
// ChatNeedName 是否需要返回群成员的名字 0-不返回;1-返回。默认不返回
const ChatNeedName int64 = 1
```
Loading

0 comments on commit bdb5402

Please sign in to comment.