Documentation ¶
Overview ¶
*
- 企业微信处理(发消息,服务于报警)
*
- 企业微信处理(发消息,服务于报警)
Index ¶
- func ECAddMsgTemplate(corp token.Base, msg *ExMsgTemplate) (string, error)
- func ECBatchDetail(corp token.Base, batch *BatchUserId) (string, error)
- func ECFollowUserList(corp token.Base) (string, error)
- func ECGetDetail(corp token.Base, externalUserid string, cursor string) (string, error)
- func ECGetList(corp token.Base, userid string) (string, error)
- func ECGetNewExternalUserId(corp token.Base, externalUseridList []string) (string, error)
- func ECGroupDetail(corp token.Base, chatId string, needName int) (string, error)
- func ECGroupList(corp token.Base) (string, error)
- func ECGroupNewExternalUserId(corp token.Base, chatId string, externalUseridList []string) (string, error)
- func ECModifyRemark(corp token.Base, remark *ExternalRemark) (string, error)
- func ECOpenGroupIdToChatId(corp token.Base, groupId string) (string, error)
- func GetAccessToken(tk token.Token, d data.D) (access.Token, error)
- func GetDepartment(api *token.Api, id string) (*[]Department, error)
- func GetDepartmentList(api *token.Api, id string) (*[]DepartmentId, error)
- func IsTokenExpired(code int32) bool
- func MigrateToCustomizedApp(api *token.Api, suiteAccessToken string) error
- func NewToken(app token.App) token.Token
- func SendMessage(api *token.Api, msg Message) error
- type Articles
- type BatchUserId
- type BatchUserIdRes
- type Content
- type DepUser
- type Department
- type DepartmentId
- type ExLink
- type ExMsgTemplate
- type ExProgram
- type ExWelcomeMsg
- type ExternalAttr
- type ExternalContact
- type ExternalContactDetail
- type ExternalProfile
- type ExternalRemark
- type ExternalUserIdItem
- type ExternalUserIdList
- type ExternalUserIds
- type FollowInfo
- type Group
- type Image
- type Message
- type News
- type OpenUserId
- type OpenUserIdInfo
- type TextCard
- type ToAgent
- type ToGroup
- type ToRoot
- type ToWho
- type UserIdReq
- type UserInfo
- type UserInfoWithCode
- type Video
- type Voice
- type WechatChannels
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ECAddMsgTemplate ¶ added in v1.0.0
func ECAddMsgTemplate(corp token.Base, msg *ExMsgTemplate) (string, error)
ECAddMsgTemplate 添加企业群发消息模板 企业可通过此接口添加企业群发消息的模板并通知客服人员发送给相关客户。(注:企业微信终端需升级到2.7.5版本及以上) 注意:调用该接口并不会直接发送消息给客户,需要相关的客服人员操作以后才会实际发送(客服人员的企业微信需要升级到2.7.5及以上版本) 同一个企业对一个客户一个自然周内(周一至周日)至多只能发送一条消息,超过限制的用户将会被忽略。
func ECBatchDetail ¶ added in v1.0.0
func ECBatchDetail(corp token.Base, batch *BatchUserId) (string, error)
ECBatchDetail 批量获取客户详情 企业/第三方可通过此接口获取指定成员添加的客户信息列表。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/batch/get_by_user?access_token=ACCESS_TOKEN
func ECFollowUserList ¶ added in v1.0.0
ECFollowUserList 获取配置了客户联系功能的成员列表 企业和第三方服务商可通过此接口获取配置了客户联系功能的成员列表。 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_follow_user_list?access_token=ACCESS_TOKEN
func ECGetDetail ¶ added in v1.0.0
ECGetDetail 获取客户详情 企业可通过此接口,根据外部联系人的userid(如何获取?),拉取客户详情。 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get?access_token=ACCESS_TOKEN&external_userid=EXTERNAL_USERID&cursor=CURSOR
func ECGetList ¶ added in v1.0.0
ECGetList 获取外部联系人列表 企业可通过此接口获取指定成员添加的客户列表。客户是指配置了客户联系功能的成员所添加的外部联系人。
func ECGetNewExternalUserId ¶ added in v1.0.0
ECGetNewExternalUserId external_userid的转换 将企业主体下的external_userid转换为服务商主体下的external_userid。 转换客户external_userid 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_new_external_userid?access_token=ACCESS_TOKEN
func ECGroupDetail ¶ added in v1.0.0
ECGroupDetail 获取客户群详情 通过客户群ID,获取详情。包括群名、群成员列表、群成员入群时间、入群方式。(客户群是由具有客户群使用权限的成员创建的外部群) 需注意的是,如果发生群信息变动,会立即收到群变更事件,但是部分信息是异步处理,可能需要等一段时间调此接口才能得到最新结果 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get?access_token=ACCESS_TOKEN
func ECGroupList ¶ added in v1.0.0
ECGroupList 获取客户群列表 该接口用于获取配置过客户群管理的客户群列表。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/list?access_token=ACCESS_TOKEN
func ECGroupNewExternalUserId ¶ added in v1.0.0
func ECGroupNewExternalUserId(corp token.Base, chatId string, externalUseridList []string) (string, error)
ECGroupNewExternalUserId 转换客户群成员external_userid 转换客户external_userid接口不支持客户群的场景,如果需要转换客户群中无好友关系的群成员external_userid,需要调用本接口,调用时需要传入客户群的chat_id。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get_new_external_userid?access_token=ACCESS_TOKEN
func ECModifyRemark ¶ added in v1.0.0
func ECModifyRemark(corp token.Base, remark *ExternalRemark) (string, error)
ECModifyRemark 修改客户备注信息 企业可通过此接口修改指定用户添加的客户的备注信息。 请求方式: POST(HTTP) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/remark?access_token=ACCESS_TOKEN
func ECOpenGroupIdToChatId ¶ added in v1.0.0
ECOpenGroupIdToChatId 客户群opengid转换 用户在微信里的客户群里打开小程序时,某些场景下可以获取到群的opengid,如果该群是企业微信的客户群,则企业或第三方可以调用此接口将一个opengid转换为客户群chat_id 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/opengid_to_chatid?access_token=ACCESS_TOKEN
func GetDepartment ¶
func GetDepartment(api *token.Api, id string) (*[]Department, error)
func GetDepartmentList ¶ added in v1.0.0
func GetDepartmentList(api *token.Api, id string) (*[]DepartmentId, error)
GetDepartmentList 获取子部门ID列表 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/department/simplelist?access_token=ACCESS_TOKEN&id=ID
func IsTokenExpired ¶
func MigrateToCustomizedApp ¶ added in v1.0.0
MigrateToCustomizedApp 自建应用迁移成代开发自建应用 该API可以将企业的自建应用关联到服务商的代开发应用模版上,从而将自建应用转换成代开发应用。测试企业的任意自建应用均可调用该接口;若非测试企业,则仅服务商管理端“历史应用迁移”列表中的应用可调用。 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/agent/migrate_to_customized_app?access_token=ACCESS_TOKEN
Types ¶
type BatchUserId ¶ added in v1.0.0
type BatchUserIdRes ¶ added in v1.0.0
type BatchUserIdRes struct { ExternalContactList []ExternalContactDetail `json:"external_contact_list"` NextCursor string `json:"next_cursor"` }
type Department ¶ added in v1.0.0
type DepartmentId ¶ added in v1.0.0
type ExMsgTemplate ¶
type ExWelcomeMsg ¶
type ExWelcomeMsg struct { Text *Content `json:"text,omitempty"` Image *Image `json:"image,omitempty"` Link *ExLink `json:"link,omitempty"` Miniprogram *ExProgram `json:"miniprogram,omitempty"` Code int64 `json:"welcome_code"` }
func (*ExWelcomeMsg) IsAgent ¶
func (h *ExWelcomeMsg) IsAgent() bool
func (*ExWelcomeMsg) IsGroup ¶
func (h *ExWelcomeMsg) IsGroup() bool
func (*ExWelcomeMsg) IsWelcome ¶
func (h *ExWelcomeMsg) IsWelcome() bool
type ExternalAttr ¶ added in v1.0.0
type ExternalAttr struct { Type int `json:"type"` Name string `json:"name"` Text struct { Value string `json:"value"` } `json:"text,omitempty"` Web struct { Url string `json:"url"` Title string `json:"title"` } `json:"web,omitempty"` Miniprogram struct { Appid string `json:"appid"` Pagepath string `json:"pagepath"` Title string `json:"title"` } `json:"miniprogram,omitempty"` }
type ExternalContact ¶ added in v1.0.0
type ExternalContact struct { ExternalUserid string `json:"external_userid"` Name string `json:"name"` Position string `json:"position"` Avatar string `json:"avatar"` CorpName string `json:"corp_name"` CorpFullName string `json:"corp_full_name"` Type int `json:"type"` Gender int `json:"gender"` Unionid string `json:"unionid"` ExternalProfile ExternalProfile `json:"external_profile,omitempty"` }
type ExternalContactDetail ¶ added in v1.0.0
type ExternalContactDetail struct { ExternalContact ExternalContact `json:"external_contact"` FollowInfo FollowInfo `json:"follow_info"` }
type ExternalProfile ¶ added in v1.0.0
type ExternalProfile struct {
ExternalAttr []ExternalAttr `json:"external_attr"`
}
type ExternalRemark ¶ added in v1.0.0
type ExternalRemark struct { Userid string `json:"userid"` ExternalUserid string `json:"external_userid"` Remark string `json:"remark"` Description string `json:"description"` RemarkCompany string `json:"remark_company"` RemarkMobiles []string `json:"remark_mobiles"` RemarkPicMediaid string `json:"remark_pic_mediaid"` }
type ExternalUserIdItem ¶ added in v1.0.0
type ExternalUserIdList ¶ added in v1.0.0
type ExternalUserIdList struct {
ExternalUserid []string `json:"external_userid"`
}
type ExternalUserIds ¶ added in v1.0.0
type ExternalUserIds struct {
Items []ExternalUserIdItem `json:"items"`
}
type FollowInfo ¶ added in v1.0.0
type FollowInfo struct { Userid string `json:"userid"` Remark string `json:"remark"` Description string `json:"description"` Createtime int `json:"createtime"` TagId []string `json:"tag_id"` RemarkCorpName string `json:"remark_corp_name,omitempty"` RemarkMobiles []string `json:"remark_mobiles,omitempty"` OperUserid string `json:"oper_userid"` AddWay int `json:"add_way"` WechatChannels WechatChannels `json:"wechat_channels,omitempty"` State string `json:"state,omitempty"` }
type Group ¶
type Group struct { Id string `json:"chatid"` Name string `json:"name"` Owner string `json:"owner"` Users []string `json:"userlist"` }
群组
type Message ¶
func NewMessage ¶
type News ¶
type News struct {
Articles []Articles `json:"articles"`
}
"news" : { "articles" : [ { "title" : "中秋节礼品领取", "description" : "今年中秋节公司有豪礼相送", "url" : "URL", "picurl" : "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png" }
type OpenUserId ¶ added in v1.0.0
type OpenUserId struct { OpenUseridList []OpenUserIdInfo `json:"open_userid_list"` InvalidUseridList []string `json:"invalid_userid_list"` }
func BatchUserIdToOpenUserId ¶ added in v1.0.0
func BatchUserIdToOpenUserId(api *token.Api, user *UserIdReq) (*OpenUserId, error)
BatchUserIdToOpenUserId userid的转换 doc: https://developer.work.weixin.qq.com/document/path/95435 将企业主体下的明文userid转换为服务商主体下的密文userid。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/batch/userid_to_openuserid?access_token=ACCESS_TOKEN
type OpenUserIdInfo ¶ added in v1.0.0
type TextCard ¶
type TextCard struct { Title string `json:"title"` Desc string `json:"description"` Url string `json:"url"` BtnTxt string `json:"btntxt"` }
"textcard" : { "title" : "领奖通知", "description" : "<div class=\"gray\">2016年9月26日</div> <div class=\"normal\">恭喜你抽中iPhone 7一台,领奖码:xxxx</div><div class=\"highlight\">请于2016年10月10日前联系行政同事领取</div>", "url" : "URL", "btntxt":"更多" }
type ToAgent ¶
type UserInfo ¶ added in v1.0.0
type UserInfo struct { Userid string `json:"userid"` Gender string `json:"gender"` Avatar string `json:"avatar"` QrCode string `json:"qr_code"` Mobile string `json:"mobile"` Email string `json:"email"` BizMail string `json:"biz_mail"` Address string `json:"address"` }
func USGetInfoWithTicket ¶ added in v1.0.0
USGetInfoWithTicket 获取访问用户敏感信息 自建应用与代开发应用可通过该接口获取成员授权的敏感字段 对于自建应用与代开发应用,敏感字段需要管理员在应用详情里选择,且成员oauth2授权时确认后才返回。 敏感字段包括:性别、头像、员工个人二维码、手机、邮箱、企业邮箱、地址。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?access_token=ACCESS_TOKEN
type UserInfoWithCode ¶ added in v1.0.0
func USGetInfoWithCode ¶ added in v1.0.0
func USGetInfoWithCode(api *token.Api, code string) (*UserInfoWithCode, error)
USGetInfoWithCode 获取访问用户身份 该接口用于根据code获取成员信息 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=ACCESS_TOKEN&code=CODE