go_qywechat

package module
v1.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 19 Imported by: 0

README

go-qywechat

GitHub issues GitHub forks GitHub stars GitHub license Twitter

import (
    "github.com/xqk/go-qywechat" // package qywechat
)
客户联系 API
  • 成员对外信息
  • 企业服务人员管理
    • 获取配置了客户联系功能的成员列表
    • 客户联系「联系我」管理
  • 客户管理
    • 获取客户列表
    • 获取客户详情
    • 批量获取客户详情
    • 修改客户备注信息
    • 客户联系规则组管理
  • 在职继承
    • 分配在职成员的客户
    • 查询客户接替状态
    • 分配在职成员的客户群
  • 离职继承
    • 获取待分配的离职成员列表
    • 分配离职成员的客户
    • 查询客户接替状态
    • 分配离职成员的客户群
  • 客户标签管理
    • 管理企业标签
    • 编辑客户企业标签
  • 客户分配
    • 获取离职成员列表
    • 分配在职或离职成员的客户
    • 查询客户接替结果
    • 分配离职成员的客户群
  • 变更回调通知
    • 添加企业客户事件
    • 编辑企业客户事件
    • 外部联系人免验证添加成员事件
    • 删除企业客户事件
    • 删除跟进成员事件
    • 客户接替失败事件
    • 客户群变更事件

Documentation

Index

Constants

View Source
const ChatNeedName int64 = 1

ChatNeedName 是否需要返回群成员的名字 0-不返回;1-返回。默认不返回

View Source
const DefaultQYAPIHost = "https://qyapi.weixin.qq.com"

DefaultQYAPIHost 默认企业微信 API Host

View Source
const EventTypeAppMenuClick = "click"

EventTypeAppMenuClick 点击菜单

View Source
const EventTypeAppMenuLocationSelect = "location_select"

EventTypeAppMenuLocationSelect 弹出微信位置选择器

View Source
const EventTypeAppMenuPicPhotoOrAlbum = "pic_photo_or_album"

EventTypeAppMenuPicPhotoOrAlbum 弹出系统拍照发图

View Source
const EventTypeAppMenuPicSysPhoto = "pic_sysphoto"

EventTypeAppMenuPicSysPhoto 弹出系统拍照发图

View Source
const EventTypeAppMenuPicWeixin = "pic_weixin"

EventTypeAppMenuPicWeixin 弹出微信相册发图器

View Source
const EventTypeAppMenuScanCodePush = "scancode_push"

EventTypeAppMenuScanCodePush 扫码上传

View Source
const EventTypeAppMenuScanCodeWaitMsg = "scancode_waitmsg"

EventTypeAppMenuScanCodeWaitMsg 扫码等待消息

View Source
const EventTypeAppMenuView = "view"

EventTypeAppMenuCView 打开菜单链接

View Source
const EventTypeAppSubscribe = "subscribe"

EventTypeAppSubscribe 应用订阅

View Source
const EventTypeAppUnsubscribe = "unsubscribe"

EventTypeAppUnsubscribe 应用订阅取消

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchListExternalContactsResp

type BatchListExternalContactsResp struct {
	Result     []ExternalContactBatchInfo
	NextCursor string
}

BatchListExternalContactsResp 外部联系人信息

type ChangeType added in v1.0.10

type ChangeType string

ChangeType 变更类型

const ChangeTypeAddExternalContact ChangeType = "add_external_contact"

ChangeTypeAddExternalContact 添加企业客户事件

const ChangeTypeAddHalfExternalContact ChangeType = "add_half_external_contact"

ChangeTypeAddHalfExternalContact 外部联系人免验证添加成员事件

const ChangeTypeCreateUser ChangeType = "create_user"

ChangeTypeCreateUser 新增成员事件

const ChangeTypeDelExternalContact ChangeType = "del_external_contact"

ChangeTypeDelExternalContact 删除企业客户事件

const ChangeTypeDelFollowUser ChangeType = "del_follow_user"

ChangeTypeDelFollowUser 删除跟进成员事件

const ChangeTypeDeleteUser ChangeType = "delete_user"

ChangeTypeDeleteUser 删除成员事件

const ChangeTypeEditExternalContact ChangeType = "edit_external_contact"

ChangeTypeEditExternalContact 编辑企业客户事件

const ChangeTypeTransferFail ChangeType = "transfer_fail"

ChangeTypeTransferFail 客户接替失败事件

const ChangeTypeUpdateUser ChangeType = "update_user"

ChangeTypeUpdateUser 更新成员事件

type ChatAdminList

type ChatAdminList struct {
	// UserID 管理员ID
	UserID string `json:"userid"`
}

ChatAdminList 客户群管理员列表

type ChatInfo

type ChatInfo struct {
	// ChatID 群聊唯一标志
	ChatID string `json:"chatid"`
	// Name 群聊名
	Name string `json:"name"`
	// OwnerUserID 群主id
	OwnerUserID string `json:"owner"`
	// MemberUserIDs 群成员id列表
	MemberUserIDs []string `json:"userlist"`
}

ChatInfo 群聊信息

type ChatMemberList

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

ChatMemberList 客户群成员列表

type ChatMemberListInvitor

type ChatMemberListInvitor struct {
	// UserID 邀请者ID
	UserID string `json:"userid"`
}

ChatMemberListInvitor 入群邀请者

type Conclusions

type Conclusions struct {
	// Text 文本消息
	Text Text `json:"text"`
	// Image 图片
	Image Image `json:"image"`
	// Link 链接
	Link Link `json:"link"`
	// MiniProgram 小程序
	MiniProgram MiniProgram `json:"miniprogram"`
}

Conclusions 结束语,会话结束时自动发送给客户

type CtorOption

type CtorOption interface {
	// contains filtered or unexported methods
}

CtorOption 客户端对象构造参数

func WithCache

func WithCache(host, password string, db int) CtorOption

WithCache 使用给定的 redis 作为 缓存 客户端

func WithHTTPClient

func WithHTTPClient(client *http.Client) CtorOption

WithHTTPClient 使用给定的 http.Client 作为 HTTP 客户端

func WithQYAPIHost

func WithQYAPIHost(host string) CtorOption

WithQYAPIHost 覆盖默认企业微信 API 域名

type DeptInfo

type DeptInfo struct {
	// ID 部门 ID
	ID int64 `json:"id"`
	// Name 部门名称
	Name string `json:"name"`
	// ParentID 父亲部门id。根部门为1
	ParentID int64 `json:"parentid"`
	// Order 在父部门中的次序值。order值大的排序靠前。值范围是[0, 2^32)
	Order uint32 `json:"order"`
}

DeptInfo 部门信息

type EventAddExternalContact added in v1.0.10

type EventAddExternalContact interface {

	// GetUserID 企业服务人员的UserID
	GetUserID() string

	// GetExternalUserID 外部联系人的userid,注意不是企业成员的帐号
	GetExternalUserID() string

	// GetState 添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道
	GetState() string

	// GetWelcomeCode 欢迎语code,可用于发送欢迎语
	GetWelcomeCode() string
	// contains filtered or unexported methods
}

EventAddExternalContact 添加企业客户事件的参数。

type EventAddHalfExternalContact added in v1.0.10

type EventAddHalfExternalContact interface {

	// GetUserID 企业服务人员的UserID
	GetUserID() string

	// GetExternalUserID 外部联系人的userid,注意不是企业成员的帐号
	GetExternalUserID() string

	// GetState 添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道
	GetState() string
	// contains filtered or unexported methods
}

EventAddHalfExternalContact 外部联系人免验证添加成员事件。

type EventChangeExternalChat added in v1.0.10

type EventChangeExternalChat interface {

	// GetChatID 群ID
	GetChatID() string

	// GetToUserName 企业微信CorpID
	GetToUserName() string

	// GetFromUserName 此事件该值固定为sys,表示该消息由系统生成
	GetFromUserName() string

	// GetFailReason 接替失败的原因, customer_refused-客户拒绝, customer_limit_exceed-接替成员的客户数达到上限
	GetFailReason() string
	// contains filtered or unexported methods
}

EventChangeExternalChat 客户群变更事件

type EventDelExternalContact added in v1.0.10

type EventDelExternalContact interface {

	// GetUserID 企业服务人员的UserID
	GetUserID() string

	// GetExternalUserID 外部联系人的userid,注意不是企业成员的帐号
	GetExternalUserID() string
	// contains filtered or unexported methods
}

EventDelExternalContact 删除企业客户事件

type EventDelFollowUser added in v1.0.10

type EventDelFollowUser interface {

	// GetUserID 企业服务人员的UserID
	GetUserID() string

	// GetExternalUserID 外部联系人的userid,注意不是企业成员的帐号
	GetExternalUserID() string
	// contains filtered or unexported methods
}

EventDelFollowUser 删除跟进成员事件

type EventEditExternalContact added in v1.0.10

type EventEditExternalContact interface {

	// GetUserID 企业服务人员的UserID
	GetUserID() string

	// GetExternalUserID 外部联系人的userid,注意不是企业成员的帐号
	GetExternalUserID() string

	// GetState 添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道
	GetState() string
	// contains filtered or unexported methods
}

EventEditExternalContact 编辑企业客户事件的参数。

type EventSysApprovalChange added in v1.0.10

type EventSysApprovalChange interface {

	// GetApprovalInfo 获取审批模板详情
	GetApprovalInfo() OAApprovalInfo
	// contains filtered or unexported methods
}

EventSysApprovalChange 审批申请状态变化回调通知

type EventTransferFail added in v1.0.10

type EventTransferFail interface {

	// GetUserID 企业服务人员的UserID
	GetUserID() string

	// GetExternalUserID 外部联系人的userid,注意不是企业成员的帐号
	GetExternalUserID() string

	// GetFailReason 接替失败的原因, customer_refused-客户拒绝, customer_limit_exceed-接替成员的客户数达到上限
	GetFailReason() string
	// contains filtered or unexported methods
}

EventTransferFail 客户接替失败事件

type EventType added in v1.0.10

type EventType string

EventType 事件类型

const EventTypeChangeContact EventType = "change_contact"

EventTypeChangeContact 通讯录回调通知

const EventTypeChangeExternalChat EventType = "change_external_chat"

EventTypeChangeExternalChat 客户群变更事件

const EventTypeChangeExternalContact EventType = "change_external_contact"

EventTypeChangeExternalContact 企业客户事件

const EventTypeSysApprovalChange EventType = "sys_approval_change"

EventTypeSysApprovalChange 审批申请状态变化回调通知

type ExternalAttr

type ExternalAttr struct {
	// Type 属性类型: 0-文本 1-网页 2-小程序
	Type int `json:"type"`
	// Name 属性名称: 需要先确保在管理端有创建该属性,否则会忽略
	Name string `json:"name"`
	// Text 文本类型的属性 ,type为0时必填
	Text ExternalAttrText `json:"text"`
	// Web 网页类型的属性,url和title字段要么同时为空表示清除该属性,要么同时不为空 ,type为1时必填
	Web ExternalAttrWeb `json:"web"`
	// Miniprogram 小程序类型的属性,appid和title字段要么同时为空表示清除改属性,要么同时不为空 ,type为2时必填
	Miniprogram ExternalAttrMiniprogram `json:"miniprogram"`
}

ExternalAttr 属性列表,目前支持文本、网页、小程序三种类型

type ExternalAttrMiniprogram

type ExternalAttrMiniprogram struct {
	// Appid 小程序appid,必须是有在本企业安装授权的小程序,否则会被忽略
	Appid string `json:"appid"`
	// Pagepath 小程序的页面路径
	Pagepath string `json:"pagepath"`
	// Title 企业对外简称,需从已认证的企业简称中选填。可在“我的企业”页中查看企业简称认证状态。
	Title string `json:"title"`
}

ExternalAttrMiniprogram 小程序类型的属性,appid和title字段要么同时为空表示清除改属性,要么同时不为空 ,type为2时必填

type ExternalAttrText

type ExternalAttrText struct {
	// Value 文本属性内容,长度限制12个UTF8字符
	Value string `json:"value"`
}

ExternalAttrText 文本类型的属性

type ExternalAttrWeb

type ExternalAttrWeb struct {
	// Url 网页的url,必须包含http或者https头
	Url string `json:"url"`
	// Title 网页的展示标题,长度限制12个UTF8字符
	Title string `json:"title"`
}

ExternalAttrWeb 网页类型的属性,url和title字段要么同时为空表示清除该属性,要么同时不为空 ,type为1时必填

type ExternalContact

type ExternalContact struct {
	// ExternalUserid 外部联系人的userid
	ExternalUserid string `json:"external_userid"`
	// Name 外部联系人的名称,如果外部联系人为微信用户,则返回外部联系人的名称为其微信昵称;如果外部联系人为企业微信用户,则会按照以下优先级顺序返回:此外部联系人或管理员设置的昵称、认证的实名和账号名称。
	Name string `json:"name"`
	// Position 外部联系人的职位,如果外部企业或用户选择隐藏职位,则不返回,仅当联系人类型是企业微信用户时有此字段
	Position string `json:"position"`
	// Avatar 外部联系人头像,第三方不可获取
	Avatar string `json:"avatar"`
	// CorpName 外部联系人所在企业的简称,仅当联系人类型是企业微信用户时有此字段
	CorpName string `json:"corp_name"`
	// Type 外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户
	Type ExternalUserType `json:"type"`
	// Gender 外部联系人性别 0-未知 1-男性 2-女性
	Gender UserGender `json:"gender"`
	// Unionid 外部联系人在微信开放平台的唯一身份标识(微信unionid),通过此字段企业可将外部联系人与公众号/小程序用户关联起来。仅当联系人类型是微信用户,且企业或第三方服务商绑定了微信开发者ID有此字段。查看绑定方法 关于返回的unionid,如果是第三方应用调用该接口,则返回的unionid是该第三方服务商所关联的微信开放者帐号下的unionid。也就是说,同一个企业客户,企业自己调用,与第三方服务商调用,所返回的unionid不同;不同的服务商调用,所返回的unionid也不同。
	Unionid string `json:"unionid"`
	// ExternalProfile 成员对外信息
	ExternalProfile ExternalProfile `json:"external_profile"`
}

ExternalContact 外部联系人

type ExternalContactAddContact added in v1.0.11

type ExternalContactAddContact struct {
	ConfigID string `json:"config_id"`
	QRCode   string `json:"qr_code"`
}

type ExternalContactBatchInfo

type ExternalContactBatchInfo struct {
	ExternalContact ExternalContact `json:"external_contact"`
	FollowInfo      FollowInfo      `json:"follow_info"`
}

ExternalContactBatchInfo 外部联系人信息

type ExternalContactContactWay added in v1.0.11

type ExternalContactContactWay struct {
	ConfigID string `json:"config_id"`
	QRCode   string `json:"qr_code"`
	ExternalContactWay
}

type ExternalContactCorpTag

type ExternalContactCorpTag struct {
	// ID 标签id
	ID string `json:"id"`
	// Name 标签名称
	Name string `json:"name"`
	// CreateTime 标签创建时间
	CreateTime int `json:"create_time"`
	// Order 标签排序的次序值,order值大的排序靠前。有效的值范围是[0, 2^32)
	Order uint32 `json:"order"`
	// Deleted 标签是否已经被删除,只在指定tag_id进行查询时返回
	Deleted bool `json:"deleted"`
}

ExternalContactCorpTag 企业客户标签

type ExternalContactCorpTagGroup

type ExternalContactCorpTagGroup struct {
	// GroupID 标签组id
	GroupID string `json:"group_id"`
	// GroupName 标签组名称
	GroupName string `json:"group_name"`
	// CreateTime 标签组创建时间
	CreateTime int `json:"create_time"`
	// Order 标签组排序的次序值,order值大的排序靠前。有效的值范围是[0, 2^32)
	Order uint32 `json:"order"`
	// Deleted 标签组是否已经被删除,只在指定tag_id进行查询时返回
	Deleted bool `json:"deleted"`
	// Tag 标签组内的标签列表
	Tag []ExternalContactCorpTag `json:"tag"`
}

ExternalContactCorpTagGroup 企业客户标签

type ExternalContactFollowUserList

type ExternalContactFollowUserList struct {
	// FollowUser 配置了客户联系功能的成员userid列表
	FollowUser []string `json:"follow_user"`
}

ExternalContactFollowUserList 配置了客户联系功能的成员列表

type ExternalContactGroupChatTransferFailed

type ExternalContactGroupChatTransferFailed struct {
	// ChatID 没能成功继承的群ID
	ChatID string `json:"chat_id"`
	// ErrCode 没能成功继承的群,错误码
	ErrCode int `json:"errcode"`
	// ErrMsg 没能成功继承的群,错误描述
	ErrMsg string `json:"errmsg"`
}

ExternalContactGroupChatTransferFailed 离职成员的群再分配失败

type ExternalContactInfo added in v1.0.4

type ExternalContactInfo struct {
	ExternalContact ExternalContact `json:"external_contact"`
	FollowUser      []FollowUser    `json:"follow_user"`
}

ExternalContactInfo 外部联系人信息

type ExternalContactListContactWayChat added in v1.0.11

type ExternalContactListContactWayChat struct {
	NextCursor string       `json:"next_cursor"`
	ContactWay []contactWay `json:"contact_way"`
}

type ExternalContactMarkTag

type ExternalContactMarkTag struct {
	// UserID 添加外部联系人的userid
	UserID string `json:"userid"`
	// ExternalUserID 外部联系人userid
	ExternalUserID string `json:"external_userid"`
	// AddTag 要标记的标签列表
	AddTag []string `json:"add_tag"`
	// RemoveTag 要移除的标签列表
	RemoveTag []string `json:"remove_tag"`
}

ExternalContactMarkTag 企业标记客户标签

type ExternalContactRemark

type ExternalContactRemark struct {
	// Userid 企业成员的userid
	Userid string `json:"userid"`
	// ExternalUserid 外部联系人userid
	ExternalUserid string `json:"external_userid"`
	// Remark 此用户对外部联系人的备注,最多20个字符,remark,description,remark_company,remark_mobiles和remark_pic_mediaid不可同时为空。
	Remark string `json:"remark"`
	// Description 此用户对外部联系人的描述,最多150个字符
	Description string `json:"description"`
	// RemarkCompany 此用户对外部联系人备注的所属公司名称,最多20个字符,remark_company只在此外部联系人为微信用户时有效。
	RemarkCompany string `json:"remark_company"`
	// RemarkMobiles 此用户对外部联系人备注的手机号,如果填写了remark_mobiles,将会覆盖旧的备注手机号。如果要清除所有备注手机号,请在remark_mobiles填写一个空字符串(“”)。
	RemarkMobiles []string `json:"remark_mobiles"`
	// RemarkPicMediaid 备注图片的mediaid,remark_pic_mediaid可以通过素材管理接口获得。
	RemarkPicMediaid string `json:"remark_pic_mediaid"`
}

ExternalContactRemark 客户备注信息

type ExternalContactTransferStatus

type ExternalContactTransferStatus uint8

ExternalContactTransferStatus 客户接替结果状态

const (
	// ExternalContactTransferStatusSuccess 1-接替完毕
	ExternalContactTransferStatusSuccess ExternalContactTransferStatus = 1
	// ExternalContactTransferStatusWait 2-等待接替
	ExternalContactTransferStatusWait ExternalContactTransferStatus = 2
	// ExternalContactTransferStatusRefused 3-客户拒绝
	ExternalContactTransferStatusRefused ExternalContactTransferStatus = 3
	// ExternalContactTransferStatusExhausted 4-接替成员客户达到上限
	ExternalContactTransferStatusExhausted ExternalContactTransferStatus = 4
	// ExternalContactTransferStatusNoData 5-无接替记录
	ExternalContactTransferStatusNoData ExternalContactTransferStatus = 5
)

type ExternalContactUnassigned

type ExternalContactUnassigned struct {
	// HandoverUserID 离职成员的userid
	HandoverUserID string
	// ExternalUserID 外部联系人userid
	ExternalUserID string
	// DemissionTime 成员离职时间
	DemissionTime time.Time
}

ExternalContactUnassigned 离职成员的客户

type ExternalContactUnassignedList

type ExternalContactUnassignedList struct {
	// Info 离职成员的客户
	Info []ExternalContactUnassigned `json:"info"`
	// IsLast 是否是最后一条记录
	IsLast bool `json:"is_last"`
	// NextCursor 分页查询游标,已经查完则返回空("")
	NextCursor string `json:"next_cursor"`
}

ExternalContactUnassignedList 离职成员的客户列表

type ExternalContactWay

type ExternalContactWay struct {
	// Type 联系方式类型,1-单人, 2-多人
	Type int `json:"type"`
	// Scene 场景,1-在小程序中联系,2-通过二维码联系
	Scene int `json:"scene"`
	// Style 在小程序中联系时使用的控件样式,详见附表
	Style int `json:"style"`
	// Remark 联系方式的备注信息,用于助记,不超过30个字符
	Remark string `json:"remark"`
	// SkipVerify 外部客户添加时是否无需验证,默认为true
	SkipVerify bool `json:"skip_verify"`
	// State 企业自定义的state参数,用于区分不同的添加渠道,在调用“获取外部联系人详情”时会返回该参数值,不超过30个字符 https://developer.work.weixin.qq.com/document/path/92114
	State string `json:"state"`
	// User 使用该联系方式的用户userID列表,在type为1时为必填,且只能有一个
	User []string `json:"user"`
	// Party 使用该联系方式的部门id列表,只在type为2时有效
	Party []int `json:"party"`
	// IsTemp 是否临时会话模式,true表示使用临时会话模式,默认为false
	IsTemp bool `json:"is_temp"`
	// ExpiresIn 临时会话二维码有效期,以秒为单位。该参数仅在is_temp为true时有效,默认7天,最多为14天
	ExpiresIn int `json:"expires_in"`
	// ChatExpiresIn 临时会话有效期,以秒为单位。该参数仅在is_temp为true时有效,默认为添加好友后24小时,最多为14天
	ChatExpiresIn int `json:"chat_expires_in"`
	// UnionID 可进行临时会话的客户UnionID,该参数仅在is_temp为true时有效,如不指定则不进行限制
	UnionID string `json:"unionid"`
	// Conclusions 结束语,会话结束时自动发送给客户,可参考“结束语定义”,仅在is_temp为true时有效,https://developer.work.weixin.qq.com/document/path/92572#%E7%BB%93%E6%9D%9F%E8%AF%AD%E5%AE%9A%E4%B9%89
	Conclusions Conclusions `json:"conclusions"`
}

ExternalContactWay 配置客户联系「联系我」方式

type ExternalProfile

type ExternalProfile struct {
	// ExternalCorpName 企业简称
	ExternalCorpName string `json:"external_corp_name"`
	// ExternalAttr 属性列表,目前支持文本、网页、小程序三种类型
	ExternalAttr []ExternalAttr `json:"external_attr"`
}

ExternalProfile 成员对外信息

type ExternalUserType

type ExternalUserType int

ExternalUserType 外部联系人的类型

1表示该外部联系人是微信用户 2表示该外部联系人是企业微信用户

const (
	// ExternalUserTypeWeChat 微信用户
	ExternalUserTypeWeChat ExternalUserType = 1
	// ExternalUserTypeWorkWeChat 企业微信用户
	ExternalUserTypeWorkWeChat ExternalUserType = 2
)

type FollowInfo

type FollowInfo struct {
	//  添加了外部联系人的企业成员
	FollowUserInfo
	// TagID 该成员添加此外部联系人所打标签
	TagID []string `json:"tag_id"`
}

FollowInfo 企业成员客户跟进信息,可以参考获取客户详情,但标签信息只会返回企业标签的tag_id,个人标签将不再返回

type FollowUser

type FollowUser struct {
	//  添加了外部联系人的企业成员
	FollowUserInfo
	// Tags 该成员添加此外部联系人所打标签
	Tags []FollowUserTag `json:"tags"`
}

FollowUser 添加了外部联系人的企业成员

type FollowUserAddWay

type FollowUserAddWay int

FollowUserAddWay 该成员添加此客户的来源

具体含义详见[来源定义](https://work.weixin.qq.com/api/doc/90000/90135/92114#13878/%E6%9D%A5%E6%BA%90%E5%AE%9A%E4%B9%89)

const (
	// 未知来源
	FollowUserAddWayUnknown FollowUserAddWay = 0
	// 扫描二维码
	FollowUserAddWayQRCode FollowUserAddWay = 1
	// 搜索手机号
	FollowUserAddWayMobile FollowUserAddWay = 2
	// 名片分享
	FollowUserAddWayCard FollowUserAddWay = 3
	// 群聊
	FollowUserAddWayGroupChat FollowUserAddWay = 4
	// 手机通讯录
	FollowUserAddWayAddressBook FollowUserAddWay = 5
	// 微信联系人
	FollowUserAddWayWeChatContact FollowUserAddWay = 6
	// 来自微信的添加好友申请
	FollowUserAddWayWeChatFriendApply FollowUserAddWay = 7
	// 安装第三方应用时自动添加的客服人员
	FollowUserAddWayThirdParty FollowUserAddWay = 8
	// 搜索邮箱
	FollowUserAddWayEmail FollowUserAddWay = 9
	// 内部成员共享
	FollowUserAddWayInternalShare FollowUserAddWay = 201
	// 管理员/负责人分配
	FollowUserAddWayAdmin FollowUserAddWay = 202
)

type FollowUserInfo

type FollowUserInfo struct {
	// UserID 外部联系人的userid
	UserID string `json:"userid"`
	// Remark 该成员对此外部联系人的备注
	Remark string `json:"remark"`
	// Description 该成员对此外部联系人的描述
	Description string `json:"description"`
	// Createtime 该成员添加此外部联系人的时间
	Createtime int `json:"createtime"`
	// RemarkCorpName 该成员对此客户备注的企业名称
	RemarkCorpName string `json:"remark_corp_name"`
	// RemarkMobiles 该成员对此客户备注的手机号码,第三方不可获取
	RemarkMobiles []string `json:"remark_mobiles"`
	// AddWay 该成员添加此客户的来源
	AddWay FollowUserAddWay `json:"add_way"`
	// OperUserID 发起添加的userid,如果成员主动添加,为成员的userid;如果是客户主动添加,则为客户的外部联系人userid;如果是内部成员共享/管理员分配,则为对应的成员/管理员userid
	OperUserID string `json:"oper_userid"`
	// State 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定
	State string `json:"state"`
}

FollowUserInfo 添加了外部联系人的企业成员

type FollowUserTag

type FollowUserTag struct {
	// GroupName 该成员添加此外部联系人所打标签的分组名称(标签功能需要企业微信升级到2.7.5及以上版本)
	GroupName string `json:"group_name"`
	// TagName 该成员添加此外部联系人所打标签名称
	TagName string `json:"tag_name"`
	// Type 该成员添加此外部联系人所打标签类型, 1-企业设置, 2-用户自定义
	Type FollowUserTagType `json:"type"`
}

FollowUserTag 该成员添加此外部联系人所打标签

type FollowUserTagType

type FollowUserTagType int

FollowUserTagType 该成员添加此外部联系人所打标签类型

1-企业设置 2-用户自定义

const (
	// 企业设置
	FollowUserTagTypeWork FollowUserTagType = 1
	// 用户自定义
	FollowUserTagTypeUser FollowUserTagType = 2
)

type GetOAApprovalInfoReq added in v1.0.10

type GetOAApprovalInfoReq struct {
	// StartTime 审批单提交的时间范围,开始时间,UNix时间戳
	StartTime time.Time
	// EndTime 审批单提交的时间范围,结束时间,Unix时间戳
	EndTime time.Time
	// Cursor 分页查询游标,默认为0,后续使用返回的next_cursor进行分页拉取
	Cursor int
	// Size 一次请求拉取审批单数量,默认值为100,上限值为100
	Size uint32
	// Filters 筛选条件,可对批量拉取的审批申请设置约束条件,支持设置多个条件
	Filters []OAApprovalInfoFilter
}

GetOAApprovalInfoReq 批量获取审批单号请求

type HTTPHandler added in v1.0.10

type HTTPHandler struct {
	// contains filtered or unexported fields
}

func NewHTTPHandler added in v1.0.10

func NewHTTPHandler(
	token string,
	encodingAESKey string,
	rxMessageHandler RxMessageHandler,
) (*HTTPHandler, error)

func (*HTTPHandler) ServeHTTP added in v1.0.10

func (h *HTTPHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type Image

type Image struct {
	// MediaID 图片的media_id
	MediaID string `json:"media_id"`
	// PicURL 图片的url
	PicURL string `json:"pic_url"`
}

Image 结束语,会话结束时自动发送给客户

type ImageMessageExtras added in v1.0.10

type ImageMessageExtras interface {

	// GetPicURL 返回图片消息的图片链接 URL。
	GetPicURL() string

	// GetMediaID 返回图片消息的图片媒体文件 ID。
	//
	// 可以调用【获取媒体文件】接口拉取,仅三天内有效。
	GetMediaID() string
	// contains filtered or unexported methods
}

ImageMessageExtras 图片消息的参数。

type JSCodeSession added in v1.0.7

type JSCodeSession struct {
	CorpID     string `json:"corpid"`
	UserID     string `json:"userid"`
	SessionKey string `json:"session_key"`
}

JSCodeSession 临时登录凭证

type Link struct {
	// Title 图文消息标题,最长为128字节
	Title string `json:"title"`
	// Picurl 图文消息封面的url
	Picurl string `json:"picurl"`
	// Desc 图文消息的描述,最长为512字节
	Desc string `json:"desc"`
	// URL 图文消息的链接
	URL string `json:"url"`
}

Link 结束语,会话结束时自动发送给客户

type LinkMessageExtras added in v1.0.10

type LinkMessageExtras interface {

	// GetTitle 返回链接消息的标题。
	GetTitle() string

	// GetDescription 返回链接消息的描述。
	GetDescription() string

	// GetURL 返回链接消息的跳转 URL。
	GetURL() string

	// GetPicURL 返回链接消息的封面缩略图 URL。
	GetPicURL() string
	// contains filtered or unexported methods
}

LinkMessageExtras 链接消息的参数。

type LocationMessageExtras added in v1.0.10

type LocationMessageExtras interface {

	// GetLatitude 返回位置消息的纬度(角度值;北纬为正)。
	GetLatitude() float64

	// GetLongitude 返回位置消息的经度(角度值;东经为正)。
	GetLongitude() float64

	// GetScale 返回位置消息的地图缩放大小。
	GetScale() int

	// GetLabel 返回位置消息的地理位置信息。
	GetLabel() string
	// contains filtered or unexported methods
}

LocationMessageExtras 位置消息的参数。

type Media

type Media struct {
	// contains filtered or unexported fields
}

Media 欲上传的素材

NOTE: 由于 Go `mime/multipart` 包的实现细节原因, 暂时不开放 Content-Type 定制,全部传 `application/octet-stream`。 如有需求,请去 GitHub 提 issue。

func NewMediaFromBuffer

func NewMediaFromBuffer(filename string, buf []byte) (*Media, error)

NewMediaFromBuffer 从内存创建一个欲上传的素材对象

func NewMediaFromFile

func NewMediaFromFile(f *os.File) (*Media, error)

NewMediaFromFile 从操作系统级文件创建一个欲上传的素材对象

type MessageType added in v1.0.10

type MessageType string

MessageType 消息类型

const MessageTypeEvent MessageType = "event"

MessageTypeEvent 事件消息

const MessageTypeImage MessageType = "image"

MessageTypeImage 图片消息

const MessageTypeLink MessageType = "link"

MessageTypeLink 链接消息

const MessageTypeLocation MessageType = "location"

MessageTypeLocation 位置消息

const MessageTypeText MessageType = "text"

MessageTypeText 文本消息

const MessageTypeVideo MessageType = "video"

MessageTypeVideo 视频消息

const MessageTypeVoice MessageType = "voice"

MessageTypeVoice 语音消息

type MiniProgram

type MiniProgram struct {
	// Title 小程序消息标题,最长为64字节
	Title string `json:"title"`
	// PicMediaID 小程序消息封面的mediaid,封面图建议尺寸为520*416
	PicMediaID string `json:"pic_media_id"`
	// AppID 小程序appid,必须是关联到企业的小程序应用
	AppID string `json:"appid"`
	// Page 小程序page路径
	Page string `json:"page"`
}

MiniProgram 结束语,会话结束时自动发送给客户

type OAApplyEvent added in v1.0.10

type OAApplyEvent struct {
	// CreatorUserID 申请人userid,此审批申请将以此员工身份提交,申请人需在应用可见范围内
	CreatorUserID string `json:"creator_userid"`
	// TemplateID 模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。暂不支持通过接口提交[打卡补卡][调班]模板审批单。
	TemplateID string `json:"template_id"`
	// UseTemplateApprover 审批人模式:0-通过接口指定审批人、抄送人(此时approver、notifyer等参数可用); 1-使用此模板在管理后台设置的审批流程,支持条件审批。默认为0
	UseTemplateApprover uint8 `json:"use_template_approver"`
	// Approver 审批流程信息,用于指定审批申请的审批流程,支持单人审批、多人会签、多人或签,可能有多个审批节点,仅use_template_approver为0时生效。
	Approver []OAApprover `json:"approver"`
	// Notifier 抄送人节点userid列表,仅use_template_approver为0时生效。
	Notifier []string `json:"notifyer"`
	// NotifyType 抄送方式:1-提单时抄送(默认值); 2-单据通过后抄送;3-提单和单据通过后抄送。仅use_template_approver为0时生效。
	NotifyType *uint8 `json:"notify_type"`
	// ApplyData 审批申请数据,可定义审批申请中各个控件的值,其中必填项必须有值,选填项可为空,数据结构同“获取审批申请详情”接口返回值中同名参数“apply_data”
	ApplyData OAContents `json:"apply_data"`
	// SummaryList 摘要信息,用于显示在审批通知卡片、审批列表的摘要信息,最多3行
	SummaryList []OASummaryList `json:"summary_list"`
}

OAApplyEvent 提交审批申请

type OAApprovalDetail added in v1.0.10

type OAApprovalDetail struct {
	// SpNo 审批编号
	SpNo string `json:"sp_no"`
	// SpName 审批申请类型名称(审批模板名称)
	SpName string `json:"sp_name"`
	// SpStatus 申请单状态:1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付
	SpStatus uint8 `json:"sp_status"`
	// TemplateID 审批模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。
	TemplateID string `json:"template_id"`
	// ApplyTime 审批申请提交时间,Unix时间戳
	ApplyTime int `json:"apply_time"`
	// Applicant 申请人信息
	Applicant OAApprovalDetailApplicant `json:"applyer"`
	// SpRecord 审批流程信息,可能有多个审批节点。
	SpRecord []OAApprovalDetailSpRecord `json:"sp_record"`
	// Notifier 抄送信息,可能有多个抄送节点
	Notifier []OAApprovalDetailNotifier `json:"notifyer"`
	// ApplyData 审批申请数据
	ApplyData OAContents `json:"apply_data"`
	// Comments 审批申请备注信息,可能有多个备注节点
	Comments []OAApprovalDetailComment `json:"comments"`
}

OAApprovalDetail 审批申请详情

type OAApprovalDetailApplicant added in v1.0.10

type OAApprovalDetailApplicant struct {
	// UserID 申请人userid
	UserID string `json:"userid"`
	// PartyID 申请人所在部门id
	PartyID string `json:"partyid"`
}

OAApprovalDetailApplicant 审批申请详情申请人信息

type OAApprovalDetailComment added in v1.0.10

type OAApprovalDetailComment struct {
	// CommentUserInfo 备注人信息
	CommentUserInfo OAApprovalDetailCommentUserInfo `json:"commentUserInfo"`
	// CommentTime 备注提交时间戳,Unix时间戳
	CommentTime int `json:"commenttime"`
	// CommentTontent 备注文本内容
	CommentTontent string `json:"commentcontent"`
	// CommentID 备注id
	CommentID string `json:"commentid"`
	// MediaID 备注附件id,可能有多个,media_id具体使用请参考:文档-获取临时素材
	MediaID []string `json:"media_id"`
}

OAApprovalDetailComment 审批申请备注信息,可能有多个备注节点

type OAApprovalDetailCommentUserInfo added in v1.0.10

type OAApprovalDetailCommentUserInfo struct {
	// UserID 备注人userid
	UserID string `json:"userid"`
}

OAApprovalDetailCommentUserInfo 备注人信息

type OAApprovalDetailNotifier added in v1.0.10

type OAApprovalDetailNotifier struct {
	// UserID 节点抄送人userid
	UserID string `json:"userid"`
}

OAApprovalDetailNotifier 抄送信息,可能有多个抄送节点

type OAApprovalDetailSpRecord added in v1.0.10

type OAApprovalDetailSpRecord struct {
	// SpStatus 审批节点状态:1-审批中;2-已同意;3-已驳回;4-已转审
	SpStatus uint8 `json:"sp_status"`
	// ApproverAttr 节点审批方式:1-或签;2-会签
	ApproverAttr uint8 `json:"approverattr"`
	// Details 审批节点详情,一个审批节点有多个审批人
	Details []OAApprovalDetailSpRecordDetail `json:"details"`
}

OAApprovalDetailSpRecord 审批流程信息,可能有多个审批节点。

type OAApprovalDetailSpRecordDetail added in v1.0.10

type OAApprovalDetailSpRecordDetail struct {
	// Approver 分支审批人
	Approver OAApprovalDetailSpRecordDetailApprover `json:"approver"`
	// Speech 审批意见
	Speech string `json:"speech"`
	// SpStatus 分支审批人审批状态:1-审批中;2-已同意;3-已驳回;4-已转审
	SpStatus uint8 `json:"sp_status"`
	// SpTime 节点分支审批人审批操作时间戳,0表示未操作
	SpTime int `json:"sptime"`
	// MediaID 节点分支审批人审批意见附件,media_id具体使用请参考:文档-获取临时素材
	MediaID []string `json:"media_id"`
}

OAApprovalDetailSpRecordDetail 审批节点详情,一个审批节点有多个审批人

type OAApprovalDetailSpRecordDetailApprover added in v1.0.10

type OAApprovalDetailSpRecordDetailApprover struct {
	// UserID 分支审批人userid
	UserID string `json:"userid"`
}

OAApprovalDetailSpRecordDetailApprover 分支审批人

type OAApprovalInfo added in v1.0.10

type OAApprovalInfo struct {
	// SpNo 审批编号
	SpNo string `xml:"SpNo"`
	// SpName 审批申请类型名称(审批模板名称)
	SpName string `xml:"SpName"`
	// SpStatus 申请单状态:1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付
	SpStatus string `xml:"SpStatus"`
	// TemplateID 审批模板id。可在“获取审批申请详情”、“审批状态变化回调通知”中获得,也可在审批模板的模板编辑页面链接中获得。
	TemplateID string `xml:"TemplateId"`
	// ApplyTime 审批申请提交时间,Unix时间戳
	ApplyTime string `xml:"ApplyTime"`
	// Applicant 申请人信息
	Applicant OAApprovalInfoApplicant `xml:"Applyer"`
	// SpRecord 审批流程信息,可能有多个审批节点。
	SpRecord []OAApprovalInfoSpRecord `xml:"SpRecord"`
	// Notifier 抄送信息,可能有多个抄送节点
	Notifier OAApprovalInfoNotifier `xml:"Notifyer"`
	// Comments 审批申请备注信息,可能有多个备注节点
	Comments []OAApprovalInfoComment `xml:"Comments"`
	// StatusChangeEvent 审批申请状态变化类型:1-提单;2-同意;3-驳回;4-转审;5-催办;6-撤销;8-通过后撤销;10-添加备注
	StatusChangeEvent string `xml:"StatuChangeEvent"`
}

OAApprovalInfo 审批申请状态变化回调通知

type OAApprovalInfoApplicant added in v1.0.10

type OAApprovalInfoApplicant struct {
	// UserID 申请人userid
	UserID string `xml:"UserId"`
	// Party 申请人所在部门pid
	Party string `xml:"Party"`
}

OAApprovalInfoApplicant 申请人信息

type OAApprovalInfoComment added in v1.0.10

type OAApprovalInfoComment struct {
	// CommentUserInfo 备注人信息
	CommentUserInfo OAApprovalInfoCommentUserInfo `xml:"CommentUserInfo"`
	// CommentTime 备注提交时间
	CommentTime string `xml:"CommentTime"`
	// CommentContent 备注文本内容
	CommentContent string `xml:"CommentContent"`
	// CommentID 备注id
	CommentID string `xml:"CommentId"`
	// Attach 备注意见附件,值是附件media_id具体使用请参考:文档-获取临时素材
	Attach []string `xml:"Attach"`
}

OAApprovalInfoComment 审批申请备注信息,可能有多个备注节点

type OAApprovalInfoCommentUserInfo added in v1.0.10

type OAApprovalInfoCommentUserInfo struct {
	// UserID 备注人userid
	UserID string `xml:"UserId"`
}

OAApprovalInfoCommentUserInfo 备注人信息

type OAApprovalInfoFilter added in v1.0.10

type OAApprovalInfoFilter struct {
	// Key 筛选类型,包括:template_id - 模板类型/模板id;creator - 申请人;department - 审批单提单者所在部门;sp_status - 审批状态。注意:仅“部门”支持同时配置多个筛选条件。不同类型的筛选条件之间为“与”的关系,同类型筛选条件之间为“或”的关系
	Key OAApprovalInfoFilterKey `json:"key"`
	// Value 筛选值,对应为:template_id - 模板id;creator - 申请人userid;department - 所在部门id;sp_status - 审批单状态(1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付)
	Value string `json:"value"`
}

OAApprovalInfoFilter 备注人信息

type OAApprovalInfoFilterKey added in v1.0.10

type OAApprovalInfoFilterKey string

OAApprovalInfoFilterKey 拉取审批筛选类型

const OAApprovalInfoFilterKeyCreator OAApprovalInfoFilterKey = "creator"

OAApprovalInfoFilterKeyCreator 申请人

const OAApprovalInfoFilterKeyDepartment OAApprovalInfoFilterKey = "department"

OAApprovalInfoFilterKeyDepartment 审批单提单者所在部门

const OAApprovalInfoFilterKeySpStatus OAApprovalInfoFilterKey = "sp_status"

OAApprovalInfoFilterKeySpStatus 审批状态

const OAApprovalInfoFilterKeyTemplateID OAApprovalInfoFilterKey = "template_id"

OAApprovalInfoFilterKeyTemplateID 模板类型

type OAApprovalInfoNotifier added in v1.0.10

type OAApprovalInfoNotifier struct {
	// UserID 节点抄送人userid
	UserID string `xml:"UserId"`
}

OAApprovalInfoNotifier 抄送信息,可能有多个抄送节点

type OAApprovalInfoSpRecord added in v1.0.10

type OAApprovalInfoSpRecord struct {
	// SpStatus 审批节点状态:1-审批中;2-已同意;3-已驳回;4-已转审
	SpStatus string `xml:"SpStatus"`
	// ApproverAttr 节点审批方式:1-或签;2-会签
	ApproverAttr string `xml:"ApproverAttr"`
	// Details 审批节点详情。当节点为标签或上级时,一个节点可能有多个分支
	Details []OAApprovalInfoSpRecordDetail `xml:"Details"`
}

OAApprovalInfoSpRecord 审批流程信息,可能有多个审批节点。

type OAApprovalInfoSpRecordDetail added in v1.0.10

type OAApprovalInfoSpRecordDetail struct {
	// Approver 分支审批人
	Approver OAApprovalInfoSpRecordDetailApprover `xml:"Approver"`
	// Speech 审批意见字段
	Speech string `xml:"Speech"`
	// SpStatus 分支审批人审批状态:1-审批中;2-已同意;3-已驳回;4-已转审
	SpStatus string `xml:"SpStatus"`
	// SpTime 节点分支审批人审批操作时间,0为尚未操作
	SpTime string `xml:"SpTime"`
	// Attach 节点分支审批人审批意见附件,赋值为media_id具体使用请参考:文档-获取临时素材
	Attach []string `xml:"Attach"`
}

OAApprovalInfoSpRecordDetail 审批节点详情。当节点为标签或上级时,一个节点可能有多个分支

type OAApprovalInfoSpRecordDetailApprover added in v1.0.10

type OAApprovalInfoSpRecordDetailApprover struct {
	// UserID 分支审批人userid
	UserID string `xml:"UserId"`
}

OAApprovalInfoSpRecordDetailApprover 分支审批人

type OAApprover added in v1.0.10

type OAApprover struct {
	// Attr 节点审批方式:1-或签;2-会签,仅在节点为多人审批时有效
	Attr uint8 `json:"attr"`
	// UserID 审批节点审批人userid列表,若为多人会签、多人或签,需填写每个人的userid
	UserID []string `json:"userid"`
}

OAApprover 审批流程信息

type OAContent added in v1.0.10

type OAContent struct {
	// Control 控件类型:Text-文本;Textarea-多行文本;Number-数字;Money-金额;Date-日期/日期+时间;Selector-单选/多选;;Contact-成员/部门;Tips-说明文字;File-附件;Table-明细;
	Control OAControl `json:"control"`
	// ID 控件id:控件的唯一id,可通过“获取审批模板详情”接口获取
	ID string `json:"id"`
	// Title 控件名称 ,若配置了多语言则会包含中英文的控件名称
	Title []OAText `json:"title"`
	// Value 控件值 ,需在此为申请人在各个控件中填写内容不同控件有不同的赋值参数,具体说明详见附录。模板配置的控件属性为必填时,对应value值需要有值。
	Value OAContentValue `json:"value"`
}

OAContent 审批申请详情,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息

type OAContentDate added in v1.0.10

type OAContentDate struct {
	// Type 时间展示类型:day-日期;hour-日期+时间 ,和对应模板控件属性一致
	Type string `json:"type"`
	// Timestamp 时间戳-字符串类型,在此填写日期/日期+时间控件的选择值,以此为准
	Timestamp string `json:"s_timestamp"`
}

OAContentDate 日期/日期+时间内容

type OAContentDateRange added in v1.0.10

type OAContentDateRange struct {
	// NewBegin 开始时间,unix时间戳
	NewBegin int `json:"new_begin"`
	// NewEnd 结束时间,unix时间戳
	NewEnd int `json:"new_end"`
	// NewDuration 时长范围,单位秒
	NewDuration int `json:"new_duration"`
}

OAContentDateRange 时长组件

type OAContentDepartment added in v1.0.10

type OAContentDepartment struct {
	// OpenAPIID 所选部门id
	OpenAPIID string `json:"openapi_id"`
	// Name 所选部门名
	Name string `json:"name"`
}

OAContentDepartment 所选部门内容,即申请人在此控件选择的部门,多选模式下可能有多个

type OAContentFile added in v1.0.10

type OAContentFile struct {
	// FileID 文件id,该id为临时素材上传接口返回的的media_id,注:提单后将作为单据内容转换为长期文件存储;目前一个审批申请单,全局仅支持上传6个附件,否则将失败。
	FileID string `json:"file_id"`
}

OAContentFile 附件

type OAContentFormula added in v1.0.10

type OAContentFormula struct {
	// Value 公式的值,提交表单时无需填写,后台自动计算
	Value string `json:"value"`
}

OAContentFormula 公式控件

type OAContentLocation added in v1.0.10

type OAContentLocation struct {
	// Latitude 纬度,精确到6位小数
	Latitude string `json:"latitude"`
	// Longitude 经度,精确到6位小数
	Longitude string `json:"longitude"`
	// Title 地点标题
	Title string `json:"title"`
	// Address 地点详情地址
	Address string `json:"address"`
	// Time 选择地点的时间
	Time int `json:"time"`
}

OAContentLocation 位置控件

type OAContentMember added in v1.0.10

type OAContentMember struct {
	// UserID 所选成员的userid
	UserID string `json:"userid"`
	// Name 成员名
	Name string `json:"name"`
}

OAContentMember 所选成员内容,即申请人在此控件选择的成员,多选模式下可以有多个

type OAContentRelatedApproval added in v1.0.10

type OAContentRelatedApproval struct {
	// SpNo 关联审批单的审批单号
	SpNo string `json:"sp_no"`
}

OAContentRelatedApproval 关联审批单控件

type OAContentSelector added in v1.0.10

type OAContentSelector struct {
	// Type 选择方式:single-单选;multi-多选
	Type string `json:"type"`
	// Options 多选选项,多选属性的选择控件允许输入多个
	Options []OAContentSelectorOption `json:"options"`
}

OAContentSelector 类型标志,单选/多选控件的config中会包含此参数

type OAContentSelectorOption added in v1.0.10

type OAContentSelectorOption struct {
	// Key 选项key,可通过“获取审批模板详情”接口获得
	Key string `json:"key"`
}

OAContentSelectorOption 多选选项,多选属性的选择控件允许输入多个

type OAContentTableList added in v1.0.10

type OAContentTableList struct {
	// List 子明细列表,在此填写子明细的所有子控件的值,子控件的数据结构同一般控件
	List []OAContent `json:"list"`
}

OAContentTableList 子明细列表,在此填写子明细的所有子控件的值,子控件的数据结构同一般控件

type OAContentVacation added in v1.0.10

type OAContentVacation struct {
	// Selector 请假类型,所选选项与假期管理关联,为假期管理中的假期类型
	Selector OAContentSelector `json:"selector"`
	// Attendance 假勤组件
	Attendance OAContentVacationAttendance `json:"attendance"`
}

OAContentVacation 请假内容,即申请人在此组件内选择的请假信息

type OAContentVacationAttendance added in v1.0.10

type OAContentVacationAttendance struct {
	// DateRange 假勤组件时间选择范围
	DateRange OAContentVacationAttendanceDateRange `json:"date_range"`
	// Type 假勤组件类型:1-请假;3-出差;4-外出;5-加班
	Type uint8 `json:"type"`
}

OAContentVacationAttendance 假勤组件

type OAContentVacationAttendanceDateRange added in v1.0.10

type OAContentVacationAttendanceDateRange struct {
	// Type 时间展示类型:day-日期;hour-日期+时间
	Type string `json:"type"`
	//  时长范围
	OAContentDateRange
}

OAContentVacationAttendanceDateRange 假勤组件时间选择范围

type OAContentValue added in v1.0.10

type OAContentValue struct {
	// Text 文本/多行文本控件(control参数为Text或Textarea)
	Text string `json:"text"`
	// Number 数字控件(control参数为Number)
	Number string `json:"new_number"`
	// Money 金额控件(control参数为Money)
	Money string `json:"new_money"`
	// Date 日期/日期+时间控件(control参数为Date)
	Date OAContentDate `json:"date"`
	// Selector 单选/多选控件(control参数为Selector)
	Selector OAContentSelector `json:"selector"`
	// Members 成员控件(control参数为Contact,且value参数为members)
	Members []OAContentMember `json:"members"`
	// Departments 部门控件(control参数为Contact,且value参数为departments)
	Departments []OAContentDepartment `json:"departments"`
	// Files 附件控件(control参数为File,且value参数为files)
	Files []OAContentFile `json:"files"`
	// Table 明细控件(control参数为Table)
	Table []OAContentTableList `json:"children"`
	// Vacation 假勤组件-请假组件(control参数为Vacation)
	Vacation OAContentVacation `json:"vacation"`
	// Location 位置控件(control参数为Location,且value参数为location)
	Location OAContentLocation `json:"location"`
	// RelatedApproval 关联审批单控件(control参数为RelatedApproval,且value参数为related_approval)
	RelatedApproval []OAContentRelatedApproval `json:"related_approval"`
	// Formula 公式控件(control参数为Formula,且value参数为formula)
	Formula OAContentFormula `json:"formula"`
	// DateRange 时长组件(control参数为DateRange,且value参数为date_range)
	DateRange OAContentDateRange `json:"date_range"`
}

OAContentValue 控件值 ,需在此为申请人在各个控件中填写内容不同控件有不同的赋值参数,具体说明详见附录。模板配置的控件属性为必填时,对应value值需要有值。

type OAContents added in v1.0.10

type OAContents struct {
	// Contents 审批申请详情,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息
	Contents []OAContent `json:"contents"`
}

OAContents 审批申请详情,由多个表单控件及其内容组成,其中包含需要对控件赋值的信息

type OAControl added in v1.0.10

type OAControl string

OAControl 控件类型

const OAControlAttendance OAControl = "Attendance"

OAControlAttendance 假勤组件-出差/外出/加班组件

const OAControlContact OAControl = "Contact"

OAControlContact 成员/部门控件

const OAControlDate OAControl = "Date"

OAControlDate 日期/日期+时间控件

const OAControlDateRange OAControl = "DateRange"

OAControlDateRange 时长控件

const OAControlFile OAControl = "File"

OAControlFile 附件控件

const OAControlFormula OAControl = "Formula"

OAControlFormula 公式控件

const OAControlLocation OAControl = "Location"

OAControlLocation 位置控件

const OAControlMoney OAControl = "Money"

OAControlMoney 金额

const OAControlNumber OAControl = "Number"

OAControlNumber 数字

const OAControlRelatedApproval OAControl = "RelatedApproval"

OAControlRelatedApproval 关联审批单控件

const OAControlSelector OAControl = "Selector"

OAControlSelector 单选/多选控件

const OAControlTable OAControl = "Table"

OAControlTable 明细控件

const OAControlText OAControl = "Text"

OAControlText 文本

const OAControlTextarea OAControl = "Textarea"

OAControlTextarea 多行文本

const OAControlTips OAControl = "Tips"

OAControlTips 说明文字控件

const OAControlVacation OAControl = "Vacation"

OAControlVacation 假勤组件-请假组件

type OASummaryList added in v1.0.10

type OASummaryList struct {
	// SummaryInfo 摘要行信息,用于定义某一行摘要显示的内容
	SummaryInfo []OAText `json:"summary_info"`
}

OASummaryList 摘要行信息,用于定义某一行摘要显示的内容

type OATemplateControl added in v1.0.10

type OATemplateControl struct {
	// Property 模板控件属性,包含了模板内控件的各种属性信息
	Property OATemplateControlProperty `json:"property"`
	// Config 模板控件配置,包含了部分控件类型的附加类型、属性,详见附录说明。目前有配置信息的控件类型有:Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Table-明细;Attendance-假勤组件(请假、外出、出差、加班)
	Config OATemplateControlConfig `json:"config"`
}

OATemplateControl 模板控件信息

type OATemplateControlConfig added in v1.0.10

type OATemplateControlConfig struct {
	// Date Date控件(日期/日期+时间控件)
	Date OATemplateControlConfigDate `json:"date"`
	// Selector Selector控件(单选/多选控件)
	Selector OATemplateControlConfigSelector `json:"selector"`
	// Contact Contact控件(成员/部门控件)
	Contact OATemplateControlConfigContact `json:"contact"`
	// Table Table(明细控件)
	Table OATemplateControlConfigTable `json:"table"`
	// Attendance Attendance控件(假勤控件)
	Attendance OATemplateControlConfigAttendance `json:"attendance"`
}

OATemplateControlConfig 模板控件配置

type OATemplateControlConfigAttendance added in v1.0.10

type OATemplateControlConfigAttendance struct {
	// DateRange 假期控件属性
	DateRange OATemplateControlConfigAttendanceDateRange `json:"date_range"`
	// Type 假勤控件类型:1-请假,3-出差,4-外出,5-加班
	Type uint8 `json:"type"`
}

OATemplateControlConfigAttendance 类型标志,假勤控件的config中会包含此参数

type OATemplateControlConfigAttendanceDateRange added in v1.0.10

type OATemplateControlConfigAttendanceDateRange struct {
	// Type 时间刻度:hour-精确到分钟, halfday—上午/下午
	Type string `json:"type"`
}

OATemplateControlConfigAttendanceDateRange 假期控件属性

type OATemplateControlConfigContact added in v1.0.10

type OATemplateControlConfigContact struct {
	// Type 选择类型:single-单选;multi-多选
	Type string `json:"type"`
	// Mode 选择对象:user-成员;department-部门
	Mode string `json:"mode"`
}

OATemplateControlConfigContact 类型标志,单选/多选控件的config中会包含此参数

type OATemplateControlConfigDate added in v1.0.10

type OATemplateControlConfigDate struct {
	// Type 时间展示类型:day-日期;hour-日期+时间
	Type string `json:"type"`
}

OATemplateControlConfigDate 类型标志,日期/日期+时间控件的config中会包含此参数

type OATemplateControlConfigSelector added in v1.0.10

type OATemplateControlConfigSelector struct {
	// Type 选择类型:single-单选;multi-多选
	Type string `json:"type"`
	// Options 选项,包含单选/多选控件中的所有选项,可能有多个
	Options []OATemplateControlConfigSelectorOption `json:"options"`
}

OATemplateControlConfigSelector 类型标志,单选/多选控件的config中会包含此参数

type OATemplateControlConfigSelectorOption added in v1.0.10

type OATemplateControlConfigSelectorOption struct {
	// Key 选项key,选项的唯一id,可用于发起审批申请,为单选/多选控件赋值
	Key string `json:"key"`
	// Value 选项值,若配置了多语言则会包含中英文的选项值,默认为zh_CN中文
	Value []OAText `json:"value"`
}

OATemplateControlConfigSelectorOption 选项,包含单选/多选控件中的所有选项,可能有多个

type OATemplateControlConfigTable added in v1.0.10

type OATemplateControlConfigTable struct {
	// Children 明细内的子控件,内部结构同controls
	Children []OATemplateControl `json:"children"`
}

OATemplateControlConfigTable 类型标志,明细控件的config中会包含此参数

type OATemplateControlConfigVacation added in v1.0.10

type OATemplateControlConfigVacation struct {
	// Item 单个假期类型属性
	Item []OATemplateControlConfigVacationItem `json:"item"`
}

OATemplateControlConfigVacation 类型标志,假勤控件的config中会包含此参数

type OATemplateControlConfigVacationItem added in v1.0.10

type OATemplateControlConfigVacationItem struct {
	// ID 假期类型标识id
	ID int `json:"id"`
	// Name 假期类型名称,默认zh_CN中文名称
	Name []OAText `json:"name"`
}

OATemplateControlConfigVacationItem 类型标志,假勤控件的config中会包含此参数

type OATemplateControlProperty added in v1.0.10

type OATemplateControlProperty struct {
	// Control 模板控件属性,包含了模板内控件的各种属性信息
	Control OAControl `json:"control"`
	// ID 模板控件配置,包含了部分控件类型的附加类型、属性,详见附录说明。目前有配置信息的控件类型有:Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Table-明细;Attendance-假勤组件(请假、外出、出差、加班)
	ID string `json:"id"`
	// Title 模板控件配置,包含了部分控件类型的附加类型、属性,详见附录说明。目前有配置信息的控件类型有:Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Table-明细;Attendance-假勤组件(请假、外出、出差、加班)
	Title []OAText `json:"title"`
	// Placeholder 模板控件配置,包含了部分控件类型的附加类型、属性,详见附录说明。目前有配置信息的控件类型有:Date-日期/日期+时间;Selector-单选/多选;Contact-成员/部门;Table-明细;Attendance-假勤组件(请假、外出、出差、加班)
	Placeholder []OAText `json:"placeholder"`
	// Require 是否必填:1-必填;0-非必填
	Require uint8 `json:"require"`
	// UnPrint 是否参与打印:1-不参与打印;0-参与打印
	UnPrint uint8 `json:"un_print"`
}

OATemplateControlProperty 模板控件属性

type OATemplateControls added in v1.0.10

type OATemplateControls struct {
	// Controls 模板名称,若配置了多语言则会包含中英文的模板名称,默认为zh_CN中文
	Controls []OATemplateControl `json:"controls"`
}

OATemplateControls 模板控件数组。模板详情由多个不同类型的控件组成,控件类型详细说明见附录。

type OATemplateDetail added in v1.0.10

type OATemplateDetail struct {
	// TemplateNames 模板名称,若配置了多语言则会包含中英文的模板名称,默认为zh_CN中文
	TemplateNames []OAText `json:"template_names"`
	// TemplateContent 模板控件信息
	TemplateContent OATemplateControls `json:"template_content"`
	// Vacation Vacation控件(假勤控件)
	Vacation OATemplateControlConfigVacation `json:"vacation_list"`
}

OATemplateDetail 审批模板详情

type OAText added in v1.0.10

type OAText struct {
	// Text 文字
	Text string `json:"text"`
	// Lang 语言
	Lang string `json:"lang"`
}

OAText 通用文本信息

type QyWechat

type QyWechat struct {
	CorpID string // CorpID 企业 ID,必填
	// contains filtered or unexported fields
}

QyWechat 企业微信客户端

func New

func New(corpId string, opts ...CtorOption) *QyWechat

New 构造一个 QyWechat 客户端对象,需要提供企业 ID

func (*QyWechat) WithApp

func (c *QyWechat) WithApp(corpSecret string, agentID int64) *QyWechatApp

WithApp 构造本企业下某自建 app 的客户端

func (*QyWechat) WithSystemApp

func (c *QyWechat) WithSystemApp(appSecret string) *QyWechatSystemApp

WithSystemApp 构造本企业下系统app的客户端(系统应用:通信录、外部联系人等)

type QyWechatApp

type QyWechatApp struct {
	*QyWechat

	// CorpSecret 应用的凭证密钥,必填
	CorpSecret string

	// AgentID 应用 ID,必填
	AgentID int64
	// contains filtered or unexported fields
}

QyWechatApp 企业微信客户端(分应用)

func (*QyWechatApp) GetAccessToken added in v1.0.16

func (c *QyWechatApp) GetAccessToken() (TokenInfo, error)

func (*QyWechatApp) JSCode2Session added in v1.0.7

func (c *QyWechatApp) JSCode2Session(jscode string) (*JSCodeSession, error)

JSCode2Session 临时登录凭证校验

func (*QyWechatApp) SpawnAccessTokenRefresher added in v1.0.5

func (c *QyWechatApp) SpawnAccessTokenRefresher()

SpawnAccessTokenRefresher 启动该 app 的 access token 刷新 goroutine

NOTE: 该 goroutine 本身没有 keep-alive 逻辑,需要自助保活

func (*QyWechatApp) SpawnAccessTokenRefresherWithContext added in v1.0.5

func (c *QyWechatApp) SpawnAccessTokenRefresherWithContext(ctx context.Context)

SpawnAccessTokenRefresherWithContext 启动该 app 的 access token 刷新 goroutine 可以通过 context cancellation 停止此 goroutine

NOTE: 该 goroutine 本身没有 keep-alive 逻辑,需要自助保活

type QyWechatSystemApp

type QyWechatSystemApp struct {
	*QyWechat

	AppSecret string // 系统应用的密钥
	// contains filtered or unexported fields
}

QyWechatSystemApp 企业微信客户端(系统应用:通信录、外部联系人等)

func (*QyWechatSystemApp) BatchListExternalContact

func (c *QyWechatSystemApp) BatchListExternalContact(userIDs []string, cursor string, limit int) (*BatchListExternalContactsResp, error)

BatchListExternalContact 批量获取客户详情

func (*QyWechatSystemApp) ExternalContactAddContact added in v1.0.11

func (c *QyWechatSystemApp) ExternalContactAddContact(t int, scene int, style int, remark string, skipVerify bool, state string, user []string, party []int, isTemp bool, expiresIn int, chatExpiresIn int, unionID string, conclusions Conclusions) (*ExternalContactAddContact, error)

ExternalContactAddContact 配置客户联系「联系我」方式

func (*QyWechatSystemApp) ExternalContactCloseTempChat added in v1.0.11

func (c *QyWechatSystemApp) ExternalContactCloseTempChat(userID, externalUserID string) error

ExternalContactCloseTempChat 结束临时会话

func (*QyWechatSystemApp) ExternalContactDelContactWay added in v1.0.11

func (c *QyWechatSystemApp) ExternalContactDelContactWay(configID string) error

ExternalContactDelContactWay 删除企业已配置的「联系我」方式

func (*QyWechatSystemApp) ExternalContactGetContactWay added in v1.0.11

func (c *QyWechatSystemApp) ExternalContactGetContactWay(configID string) (*ExternalContactContactWay, error)

ExternalContactGetContactWay 获取企业已配置的「联系我」方式

func (*QyWechatSystemApp) ExternalContactListContactWayChat added in v1.0.11

func (c *QyWechatSystemApp) ExternalContactListContactWayChat(startTime int, endTime int, cursor string, limit int) (*ExternalContactListContactWayChat, error)

ExternalContactListContactWayChat 获取企业已配置的「联系我」列表

func (*QyWechatSystemApp) ExternalContactListFollowUser added in v1.0.8

func (c *QyWechatSystemApp) ExternalContactListFollowUser() (*ExternalContactFollowUserList, error)

ExternalContactListFollowUser 获取配置了客户联系功能的成员列表

func (*QyWechatSystemApp) ExternalContactUpdateContactWay added in v1.0.11

func (c *QyWechatSystemApp) ExternalContactUpdateContactWay(configID string, remark string, skipVerify bool, style int, state string, user []string, party []int, expiresIn int, chatExpiresIn int, unionid string, conclusions Conclusions) error

ExternalContactUpdateContactWay 更新企业已配置的「联系我」成员配置

func (*QyWechatSystemApp) GetAccessToken added in v1.0.16

func (c *QyWechatSystemApp) GetAccessToken() (TokenInfo, error)

func (*QyWechatSystemApp) GetExternalContact added in v1.0.4

func (c *QyWechatSystemApp) GetExternalContact(externalUserID string) (*ExternalContactInfo, error)

GetExternalContact 获取客户详情

func (*QyWechatSystemApp) GetUser added in v1.0.9

func (c *QyWechatSystemApp) GetUser(userid string) (*UserInfo, error)

GetUser 读取成员

func (*QyWechatSystemApp) GetUserIDByMobile added in v1.0.9

func (c *QyWechatSystemApp) GetUserIDByMobile(mobile string) (string, error)

GetUserIDByMobile 通过手机号获取 userid

func (*QyWechatSystemApp) GetUserInfoByCode added in v1.0.9

func (c *QyWechatSystemApp) GetUserInfoByCode(code string) (*UserIdentityInfo, error)

GetUserInfoByCode 获取访问用户身份,根据code获取成员信息

func (*QyWechatSystemApp) ListExternalContact added in v1.0.6

func (c *QyWechatSystemApp) ListExternalContact(userID string) ([]string, error)

ListExternalContact 获取客户列表

func (*QyWechatSystemApp) ListUsersByDeptID added in v1.0.9

func (c *QyWechatSystemApp) ListUsersByDeptID(deptID int64, fetchChild bool) ([]*UserInfo, error)

ListUsersByDeptID 获取部门成员详情

func (*QyWechatSystemApp) SpawnAccessTokenRefresher added in v1.0.5

func (c *QyWechatSystemApp) SpawnAccessTokenRefresher()

SpawnAccessTokenRefresher 启动该 app 的 access token 刷新 goroutine

NOTE: 该 goroutine 本身没有 keep-alive 逻辑,需要自助保活

func (*QyWechatSystemApp) SpawnAccessTokenRefresherWithContext added in v1.0.5

func (c *QyWechatSystemApp) SpawnAccessTokenRefresherWithContext(ctx context.Context)

SpawnAccessTokenRefresherWithContext 启动该 app 的 access token 刷新 goroutine 可以通过 context cancellation 停止此 goroutine

NOTE: 该 goroutine 本身没有 keep-alive 逻辑,需要自助保活

type ReqChatList

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

ReqChatList 获取客户群列表参数

type ReqChatListOwnerFilter

type ReqChatListOwnerFilter struct {
	// UserIDList 用户ID列表。最多100个
	UserIDList []string `json:"userid_list"`
}

ReqChatListOwnerFilter 群主过滤

type RespAppChatInfo

type RespAppChatInfo struct {
	// ChatID 客户群ID
	ChatID string `json:"chat_id"`
	// Name 客户群名称
	Name string `json:"name"`
	// Owner 群主ID
	Owner string `json:"owner"`
	// CreateTime 群创建时间
	CreateTime int64 `json:"create_time"`
	// Notice 群公告
	Notice string `json:"notice"`
	// MemberList 群成员列表
	MemberList []*ChatMemberList `json:"member_list"`
	// AdminList 群管理员列表
	AdminList []*ChatAdminList `json:"admin_list"`
}

RespAppChatInfo 客户群详情

type RespAppchatList

type RespAppchatList struct {
	// GroupChatList 客户群列表
	GroupChatList []RespGroupChatList `json:"group_chat_list"`
	// NextCursor 分页游标
	NextCursor string `json:"next_cursor"`
}

RespAppchatList 客户群列表结果

type RespGroupChatList

type RespGroupChatList struct {
	// ChatID 客户群ID
	ChatID string `json:"chat_id"`
	// Status 客户群跟进状态 0 - 跟进人正常 1 - 跟进人离职 2 - 离职继承中 3 - 离职继承完成
	Status int64 `json:"status"`
}

RespGroupChatList 客户群列表数据

type RxMessage added in v1.0.10

type RxMessage struct {
	// FromUserID 发送者的 UserID
	FromUserID string
	// SendTime 消息发送时间
	SendTime time.Time
	// MsgType 消息类型
	MsgType MessageType
	// MsgID 消息 ID
	MsgID int64
	// AgentID 企业应用 ID,可在应用的设置页面查看
	AgentID int64
	// Event 事件类型 MsgType为event存在
	Event EventType
	// ChangeType 变更类型 Event为change_external_contact存在
	ChangeType ChangeType
	// WelcomeCode 欢迎语code,可用于发送欢迎语
	WelcomeCode string
	// contains filtered or unexported fields
}

RxMessage 一条接收到的消息

func (*RxMessage) EventAddExternalContact added in v1.0.10

func (m *RxMessage) EventAddExternalContact() (EventAddExternalContact, bool)

EventAddExternalContact 如果消息为添加企业客户事件,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventAddHalfExternalContact added in v1.0.10

func (m *RxMessage) EventAddHalfExternalContact() (EventAddHalfExternalContact, bool)

EventAddHalfExternalContact 如果消息为外部联系人免验证添加成员事件,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventAppMenuClick added in v1.0.10

func (m *RxMessage) EventAppMenuClick() (*rxEventAppMenuClick, bool)

EventAppMenuClick 如果消息为应用菜单点击事件通知,则拿出相应消息参数,否则返回 nil, false

func (*RxMessage) EventAppMenuView added in v1.0.10

func (m *RxMessage) EventAppMenuView() (*rxEventAppMenuView, bool)

EventAppMenuView 如果消息为应用菜单链接点击事件通知,则拿出相应消息参数,否则返回 nil, false

func (*RxMessage) EventAppSubscribe added in v1.0.10

func (m *RxMessage) EventAppSubscribe() (*rxEventAppSubscribe, bool)

EventAppSubscribe 如果消息为应用订阅事件通知,则拿出相应消息参数,否则返回 nil, false

func (*RxMessage) EventAppUnsubscribe added in v1.0.10

func (m *RxMessage) EventAppUnsubscribe() (*rxEventAppUnsubscribe, bool)

EventAppUnsubscribe 如果消息为应用订阅取消事件通知,则拿出相应消息参数,否则返回 nil, false

func (*RxMessage) EventChangeExternalChat added in v1.0.10

func (m *RxMessage) EventChangeExternalChat() (EventChangeExternalChat, bool)

EventChangeExternalChat 如果消息为客户群变更事件,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventChangeTypeCreateUser added in v1.0.10

func (m *RxMessage) EventChangeTypeCreateUser() (*rxEventChangeTypeCreateUser, bool)

EventChangeTypeCreateUser 如果消息为创建成员事件通知,则拿出相应消息参数,否则返回 nil, false

func (*RxMessage) EventChangeTypeUpdateUser added in v1.0.10

func (m *RxMessage) EventChangeTypeUpdateUser() (*rxEventChangeTypeUpdateUser, bool)

EventChangeTypeUpdateUser 如果消息为更新成员事件通知,则拿出相应消息参数,否则返回 nil, false

func (*RxMessage) EventDelExternalContact added in v1.0.10

func (m *RxMessage) EventDelExternalContact() (EventDelExternalContact, bool)

EventDelExternalContact 如果消息为删除企业客户事件,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventDelFollowUser added in v1.0.10

func (m *RxMessage) EventDelFollowUser() (EventDelFollowUser, bool)

EventDelFollowUser 如果消息为删除跟进成员事件,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventEditExternalContact added in v1.0.10

func (m *RxMessage) EventEditExternalContact() (EventEditExternalContact, bool)

EventEditExternalContact 如果消息为编辑企业客户事件,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventSysApprovalChange added in v1.0.10

func (m *RxMessage) EventSysApprovalChange() (EventSysApprovalChange, bool)

EventSysApprovalChange 如果消息为审批申请状态变化回调通知,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventTransferFail added in v1.0.10

func (m *RxMessage) EventTransferFail() (EventTransferFail, bool)

EventTransferFail 如果消息为客户接替失败事件,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) EventUnknown added in v1.0.10

func (m *RxMessage) EventUnknown() (*rxEventUnknown, bool)

EventUnknown 未定义的event类型

func (*RxMessage) Image added in v1.0.10

func (m *RxMessage) Image() (ImageMessageExtras, bool)

Image 如果消息为图片类型,则拿出相应的消息参数,否则返回 nil, false

func (m *RxMessage) Link() (LinkMessageExtras, bool)

Link 如果消息为链接类型,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) Location added in v1.0.10

func (m *RxMessage) Location() (LocationMessageExtras, bool)

Location 如果消息为位置类型,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) String added in v1.0.10

func (m *RxMessage) String() string

func (*RxMessage) Text added in v1.0.10

func (m *RxMessage) Text() (TextMessageExtras, bool)

Text 如果消息为文本类型,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) Video added in v1.0.10

func (m *RxMessage) Video() (VideoMessageExtras, bool)

Video 如果消息为视频类型,则拿出相应的消息参数,否则返回 nil, false

func (*RxMessage) Voice added in v1.0.10

func (m *RxMessage) Voice() (VoiceMessageExtras, bool)

Voice 如果消息为语音类型,则拿出相应的消息参数,否则返回 nil, false

type RxMessageHandler added in v1.0.10

type RxMessageHandler interface {
	// OnIncomingMessage 一条消息到来时的回调。
	OnIncomingMessage(msg *RxMessage) error
}

RxMessageHandler 用来接收消息的接口。

type Text

type Text struct {
	// Content 消息文本内容,最长为4000字节
	Content string `json:"content"`
}

Text 结束语,会话结束时自动发送给客户

type TextMessageExtras added in v1.0.10

type TextMessageExtras interface {

	// GetContent 返回文本消息的内容。
	GetContent() string
	// contains filtered or unexported methods
}

TextMessageExtras 文本消息的参数。

type TokenInfo added in v1.0.16

type TokenInfo struct {
	Token          string
	ExpiresIn      time.Duration
	ExpirationTime time.Time
}

type UserDeptInfo

type UserDeptInfo struct {
	// DeptID 部门 ID
	DeptID int64
	// Order 部门内的排序值,默认为0,数值越大排序越前面
	Order uint32
	// IsLeader 在所在的部门内是否为上级
	IsLeader bool
}

UserDeptInfo 用户部门信息

type UserGender

type UserGender int

UserGender 用户性别

const (
	// UserGenderUnspecified 性别未定义
	UserGenderUnspecified UserGender = 0
	// UserGenderMale 男性
	UserGenderMale UserGender = 1
	// UserGenderFemale 女性
	UserGenderFemale UserGender = 2
)

type UserIdentityInfo

type UserIdentityInfo struct {
	// UserID 成员UserID。若需要获得用户详情信息,可调用通讯录接口:读取成员。如果是互联企业,则返回的UserId格式如:CorpId/userid
	UserID string `json:"UserId"`
	// OpenID 非企业成员的标识,对当前企业唯一。不超过64字节
	OpenID string `json:"OpenId"`
	// DeviceID 手机设备号(由企业微信在安装时随机生成,删除重装会改变,升级不受影响)
	DeviceID string `json:"DeviceId"`
}

UserIdentityInfo 访问用户身份信息

type UserInfo

type UserInfo struct {
	// UserID 成员UserID
	//
	// 对应管理端的账号,企业内必须唯一。不区分大小写,长度为1~64个字节
	UserID string
	// Name 成员名称
	Name string
	// Position 职务信息;第三方仅通讯录应用可获取
	Position string
	// Departments 成员所属部门信息
	Departments []UserDeptInfo
	// Mobile 手机号码;第三方仅通讯录应用可获取
	Mobile string
	// Gender 性别
	Gender UserGender
	// Email 邮箱;第三方仅通讯录应用可获取
	Email string
	// AvatarURL 头像 URL;第三方仅通讯录应用可获取
	//
	// NOTE:如果要获取小图将url最后的”/0”改成”/100”即可。
	AvatarURL string
	// Telephone 座机;第三方仅通讯录应用可获取
	Telephone string
	// IsEnabled 成员的启用状态
	IsEnabled bool
	// Alias 别名;第三方仅通讯录应用可获取
	Alias string
	// Status 成员激活状态
	Status UserStatus
	// QRCodeURL 员工个人二维码;第三方仅通讯录应用可获取
	//
	// 扫描可添加为外部联系人
	QRCodeURL string
}

UserInfo 用户信息

type UserStatus

type UserStatus int

UserStatus 用户激活信息

已激活代表已激活企业微信或已关注微工作台(原企业号)。 未激活代表既未激活企业微信又未关注微工作台(原企业号)。

const (
	// UserStatusActivated 已激活
	UserStatusActivated UserStatus = 1
	// UserStatusDeactivated 已禁用
	UserStatusDeactivated UserStatus = 2
	// UserStatusUnactivated 未激活
	UserStatusUnactivated UserStatus = 4
)

type VideoMessageExtras added in v1.0.10

type VideoMessageExtras interface {

	// GetMediaID 返回视频消息的视频媒体文件 ID。
	//
	// 可以调用【获取媒体文件】接口拉取,仅三天内有效。
	GetMediaID() string

	// GetThumbMediaID 返回视频消息缩略图的媒体 ID。
	//
	// 可以调用【获取媒体文件】接口拉取,仅三天内有效。
	GetThumbMediaID() string
	// contains filtered or unexported methods
}

VideoMessageExtras 视频消息的参数。

type VoiceMessageExtras added in v1.0.10

type VoiceMessageExtras interface {

	// GetMediaID 返回语音消息的语音媒体文件 ID。
	//
	// 可以调用【获取媒体文件】接口拉取,仅三天内有效。
	GetMediaID() string

	// GetFormat 返回语音消息的语音格式,如 "amr"、"speex" 等。
	GetFormat() string
	// contains filtered or unexported methods
}

VoiceMessageExtras 语音消息的参数。

type WorkwxClientError

type WorkwxClientError struct {
	// Code 错误码,0表示成功,非0表示调用失败。
	//
	// 开发者需根据errcode是否为0判断是否调用成功(errcode意义请见全局错误码)。
	Code errcodes.ErrCode
	// Msg 错误信息,调用失败会有相关的错误信息返回。
	//
	// 仅作参考,后续可能会有变动,因此不可作为是否调用成功的判据。
	Msg string
}

WorkwxClientError 企业微信客户端 SDK 的响应错误

func (*WorkwxClientError) Error

func (e *WorkwxClientError) Error() string

Directories

Path Synopsis
examples
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL