From 20f31fc07c3e1c74feb938916b47c943f1e459f0 Mon Sep 17 00:00:00 2001 From: ihipop Date: Mon, 4 Sep 2023 14:25:10 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20EventAddHalfExternalCo?= =?UTF-8?q?ntact=20=E5=A4=96=E9=83=A8=E8=81=94=E7=B3=BB=E4=BA=BA=E5=85=8D?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=B7=BB=E5=8A=A0=E6=88=90=E5=91=98=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=20=E6=8E=A5=E5=8F=A3=E6=BC=8F=E6=8E=89=E7=9A=84=20Get?= =?UTF-8?q?WelcomeCode=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rx_msg_extras.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rx_msg_extras.go b/rx_msg_extras.go index f089b94..e9758de 100644 --- a/rx_msg_extras.go +++ b/rx_msg_extras.go @@ -480,6 +480,11 @@ type EventAddHalfExternalContact interface { // GetState 添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道 GetState() string + + // GetWelcomeCode 欢迎语code,可用于发送欢迎语 + // 当企业微信开启加好友无须验证且人员不主动添加到通讯录,则收到此事件,可以发送欢迎语 + // See also: https://developer.work.weixin.qq.com/document/path/92130#%E5%A4%96%E9%83%A8%E8%81%94%E7%B3%BB%E4%BA%BA%E5%85%8D%E9%AA%8C%E8%AF%81%E6%B7%BB%E5%8A%A0%E6%88%90%E5%91%98%E4%BA%8B%E4%BB%B6 + GetWelcomeCode() string } var _ EventAddHalfExternalContact = (*rxEventAddHalfExternalContact)(nil) From ddf69668142c77ed15c8cf1e7760eb7bbef9846b Mon Sep 17 00:00:00 2001 From: ihipop Date: Tue, 5 Sep 2023 19:00:27 +0800 Subject: [PATCH 2/6] Add TagId to FollowUserTag --- external_contact.md.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/external_contact.md.go b/external_contact.md.go index 7a32e36..6211fc6 100644 --- a/external_contact.md.go +++ b/external_contact.md.go @@ -127,7 +127,9 @@ type FollowUserTag struct { GroupName string `json:"group_name"` // TagName 该成员添加此外部联系人所打标签名称 TagName string `json:"tag_name"` - // Type 该成员添加此外部联系人所打标签类型, 1-企业设置, 2-用户自定义 + // TagId 该成员添加此外部联系人所打企业标签的id,用户自定义类型标签(type=2)不返回 + TagId string `json:"tag_id"` + // Type 该成员添加此外部联系人所打标签类型, 1-企业设置, 2-用户自定义 3-规则组标签(仅系统应用返回) Type FollowUserTagType `json:"type"` } From 93b89cf82232043378ec48a71c06e53f9ab2ee6d Mon Sep 17 00:00:00 2001 From: ihipop Date: Wed, 6 Sep 2023 11:43:27 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=A0=87=E7=AD=BE=E5=8F=98=E6=9B=B4=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rx_msg.md.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rx_msg.md.go b/rx_msg.md.go index 6c89300..c2b1607 100644 --- a/rx_msg.md.go +++ b/rx_msg.md.go @@ -52,9 +52,6 @@ type EventType string // EventTypeChangeExternalContact 企业客户事件 const EventTypeChangeExternalContact EventType = "change_external_contact" -// EventTypeChangeExternalChat 客户群变更事件 -const EventTypeChangeExternalChat EventType = "change_external_chat" - // EventTypeSysApprovalChange 审批申请状态变化回调通知 const EventTypeSysApprovalChange EventType = "sys_approval_change" @@ -82,6 +79,12 @@ const ChangeTypeDelFollowUser ChangeType = "del_follow_user" // ChangeTypeTransferFail 客户接替失败事件 const ChangeTypeTransferFail ChangeType = "transfer_fail" +// EventTypeChangeExternalChat 客户群变更事件 +const EventTypeChangeExternalChat EventType = "change_external_chat" + +// EventTypeChangeExternalTag 企业客户标签变更事件 +const EventTypeChangeExternalTag EventType = "change_external_tag" + // ChangeTypeCreateUser 新增成员事件 const ChangeTypeCreateUser ChangeType = "create_user" From f3e6d7989e1c5ee77e7f0be59cdd0338161beff4 Mon Sep 17 00:00:00 2001 From: ihipop Date: Wed, 6 Sep 2023 11:56:34 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=A0=E4=B8=AA?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=8F=98=E6=9B=B4=E7=B1=BB=E5=9E=8B=EF=BC=9A?= =?UTF-8?q?ChangeType=20=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5=E5=92=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=87=8D=E6=8E=92=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rx_msg.md.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rx_msg.md.go b/rx_msg.md.go index c2b1607..8d4260a 100644 --- a/rx_msg.md.go +++ b/rx_msg.md.go @@ -91,6 +91,21 @@ const ChangeTypeCreateUser ChangeType = "create_user" // ChangeTypeUpdateUser 更新成员事件 const ChangeTypeUpdateUser ChangeType = "update_user" +// ChangeTypeCreate 事件变更类型: 创建 +const ChangeTypeCreate ChangeType = "create" + +// ChangeTypeUpdate 事件变更类型: 更新 +const ChangeTypeUpdate ChangeType = "update" + +// ChangeTypeDismiss 事件变更类型: 解散 +const ChangeTypeDismiss ChangeType = "dismiss" + +// ChangeTypeDelete 事件变更类型: 删除 +const ChangeTypeDelete ChangeType = "delete" + +// ChangeTypeShuffle 事件变更类型: 重排 +const ChangeTypeShuffle ChangeType = "shuffle" + // EventTypeAppMenuClick 点击菜单 const EventTypeAppMenuClick = "click" From 6174bb9ec25b315b889f1b55e6fc38672cca3b22 Mon Sep 17 00:00:00 2001 From: ihipop Date: Mon, 23 Oct 2023 17:18:15 +0800 Subject: [PATCH 5/6] =?UTF-8?q?Deprecate=EF=BC=9ABatchListExternalContact?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- external_contact.go | 16 ++++++++++++---- models.go | 8 +++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/external_contact.go b/external_contact.go index b8ddbba..6cf46ec 100644 --- a/external_contact.go +++ b/external_contact.go @@ -26,12 +26,20 @@ func (c *WorkwxApp) GetExternalContact(externalUserID string) (*ExternalContactI return &resp.ExternalContactInfo, nil } -// BatchListExternalContact 批量获取客户详情 +// BatchListExternalContact +// +// Deprecated: 因为批量获取客户详情 https://developer.work.weixin.qq.com/document/path/92994 已经 deprecated UserID参数 +// 请使用 BatchListExternalContactsOfUserIDs 代替 为了保证兼容此函数保留 func (c *WorkwxApp) BatchListExternalContact(userID string, cursor string, limit int) (*BatchListExternalContactsResp, error) { + return c.BatchListExternalContactsOfUserIDs([]string{userID}, cursor, limit) +} + +// BatchListExternalContactsOfUserIDs 批量获取客户详情 支持多个不同UserID +func (c *WorkwxApp) BatchListExternalContactsOfUserIDs(userID []string, cursor string, limit int) (*BatchListExternalContactsResp, error) { resp, err := c.execExternalContactBatchList(reqExternalContactBatchList{ - UserID: userID, - Cursor: cursor, - Limit: limit, + UseridList: userID, + Cursor: cursor, + Limit: limit, }) if err != nil { return nil, err diff --git a/models.go b/models.go index c2c50c7..5fda6c1 100644 --- a/models.go +++ b/models.go @@ -526,10 +526,12 @@ type BatchListExternalContactsResp struct { } // reqExternalContactBatchList 批量获取客户详情 +// https://developer.work.weixin.qq.com/document/path/92994 +// 本接口已经支持批量请求 单个 UserID参数已经废弃 type reqExternalContactBatchList struct { - UserID string `json:"userid"` - Cursor string `json:"cursor"` - Limit int `json:"limit"` + UseridList []string `json:"userid_list"` + Cursor string `json:"cursor"` + Limit int `json:"limit"` } var _ bodyer = reqExternalContactBatchList{} From e543869425ec8a82485cdfcb83709e822ed3bcfd Mon Sep 17 00:00:00 2001 From: ihipop Date: Wed, 25 Oct 2023 16:02:21 +0800 Subject: [PATCH 6/6] =?UTF-8?q?Fix=EF=BC=9Awrong=20struct=20of=20UserIdent?= =?UTF-8?q?ityInfo=20=E5=8E=9F=E4=BD=9C=E8=80=85=E6=8A=8A=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E8=B0=83=E7=94=A8=E6=8E=88=E6=9D=83=E7=9A=84?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E4=BD=93=E6=90=9E=E5=8F=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user_info.md.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/user_info.md.go b/user_info.md.go index 55cf458..b28dd1b 100644 --- a/user_info.md.go +++ b/user_info.md.go @@ -76,11 +76,14 @@ type UserDeptInfo struct { } // UserIdentityInfo 访问用户身份信息 +// See alose https://developer.work.weixin.qq.com/document/path/91023 type UserIdentityInfo struct { // UserID 成员UserID。若需要获得用户详情信息,可调用通讯录接口:读取成员。如果是互联企业,则返回的UserId格式如:CorpId/userid - UserID string `json:"UserId"` + UserID string `json:"userid"` // OpenID 非企业成员的标识,对当前企业唯一。不超过64字节 - OpenID string `json:"OpenId"` - // DeviceID 手机设备号(由企业微信在安装时随机生成,删除重装会改变,升级不受影响) - DeviceID string `json:"DeviceId"` + OpenID string `json:"openid"` + // 成员票据,最大为512字节,有效期为1800s。 scope为snsapi_privateinfo,且用户在应用可见范围之内时返回此参数。后续利用该参数可以获取用户信息或敏感信息 + UserTicket string `json:"user_ticket"` + // 外部联系人id,当且仅当用户是企业的客户,且跟进人在应用的可见范围内时返回。如果是第三方应用调用,针对同一个客户,同一个服务商不同应用获取到的id相同 + ExternalUserid string `json:"external_userid"` }