work

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Zlib Imports: 12 Imported by: 0

Documentation

Overview

*

  • 企业微信处理(发消息,服务于报警)

*

  • 企业微信处理(发消息,服务于报警)

Index

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

func ECFollowUserList(corp token.Base) (string, error)

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

func ECGetDetail(corp token.Base, externalUserid string, cursor string) (string, error)

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

func ECGetList(corp token.Base, userid string) (string, error)

ECGetList 获取外部联系人列表 企业可通过此接口获取指定成员添加的客户列表。客户是指配置了客户联系功能的成员所添加的外部联系人。

func ECGetNewExternalUserId added in v1.0.0

func ECGetNewExternalUserId(corp token.Base, externalUseridList []string) (string, error)

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

func ECGroupDetail(corp token.Base, chatId string, needName int) (string, error)

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

func ECGroupList(corp token.Base) (string, error)

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

func ECOpenGroupIdToChatId(corp token.Base, groupId string) (string, error)

ECOpenGroupIdToChatId 客户群opengid转换 用户在微信里的客户群里打开小程序时,某些场景下可以获取到群的opengid,如果该群是企业微信的客户群,则企业或第三方可以调用此接口将一个opengid转换为客户群chat_id 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/opengid_to_chatid?access_token=ACCESS_TOKEN

func GetAccessToken

func GetAccessToken(tk token.Token, d data.D) (access.Token, error)

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 IsTokenExpired(code int32) bool

func MigrateToCustomizedApp added in v1.0.0

func MigrateToCustomizedApp(api *token.Api, suiteAccessToken string) error

MigrateToCustomizedApp 自建应用迁移成代开发自建应用 该API可以将企业的自建应用关联到服务商的代开发应用模版上,从而将自建应用转换成代开发应用。测试企业的任意自建应用均可调用该接口;若非测试企业,则仅服务商管理端“历史应用迁移”列表中的应用可调用。 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/agent/migrate_to_customized_app?access_token=ACCESS_TOKEN

func NewToken

func NewToken(app token.App) token.Token

func SendMessage

func SendMessage(api *token.Api, msg Message) error

SendMessage 发送应用消息,群聊消息,客户欢迎语

Types

type Articles

type Articles struct {
	Title  string `json:"title"`
	Desc   string `json:"description"`
	Url    string `json:"url"`
	Picurl string `json:"picurl"`
}

type BatchUserId added in v1.0.0

type BatchUserId struct {
	UseridList []string `json:"userid_list"`
	Cursor     string   `json:"cursor"`
	Limit      int      `json:"limit"`
}

type BatchUserIdRes added in v1.0.0

type BatchUserIdRes struct {
	ExternalContactList []ExternalContactDetail `json:"external_contact_list"`
	NextCursor          string                  `json:"next_cursor"`
}

type Content

type Content struct {
	Content string `json:"content"`
}

type DepUser added in v1.0.0

type DepUser struct {
	Userid     string `json:"userid"`
	Department int    `json:"department"`
}

func USGetList added in v1.0.0

func USGetList(api *token.Api, cursor string, limit int) ([]DepUser, error)

type Department added in v1.0.0

type Department struct {
	Id               int      `json:"id"`
	Name             string   `json:"name"`
	NameEn           string   `json:"name_en"`
	DepartmentLeader []string `json:"department_leader"`
	Parentid         int      `json:"parentid"`
	Order            int      `json:"order"`
}

type DepartmentId added in v1.0.0

type DepartmentId struct {
	Id       int `json:"id"`
	ParentId int `json:"parentid"`
	Order    int `json:"order"`
}
type ExLink struct {
	Title  string `json:"title"`
	Picurl string `json:"picurl"`
	Desc   string `json:"desc"`
	Url    string `json:"url"`
}

type ExMsgTemplate

type ExMsgTemplate struct {
	ExUseIds []string   `json:"external_userid"`
	Sender   string     `json:"sender"`
	Text     *Content   `json:"text,omitempty"`
	Image    *Image     `json:"image,omitempty"`
	Link     *ExLink    `json:"link,omitempty"`
	Program  *ExProgram `json:"miniprogram,omitempty"`
}

type ExProgram

type ExProgram struct {
	Title   string `json:"title"`        //"title": "消息标题",
	MediaId string `json:"pic_media_id"` //"pic_media_id": "MEDIA_ID",
	AppId   string `json:"appid"`        //"appid": "wx8bd80126147df384",
	Page    string `json:"page"`         //"page": "/path/index"
}

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 ExternalUserIdItem struct {
	ExternalUserid    string `json:"external_userid"`
	NewExternalUserid string `json:"new_external_userid"`
}

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 Image

type Image struct {
	MediaId string `json:"media_id"`
}

type Message

type Message interface {
	IsGroup() bool
	IsAgent() bool
	IsWelcome() bool
}

func NewMessage

func NewMessage(toWho ToWho, msgType string, msg interface{}) Message

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 OpenUserIdInfo struct {
	Userid     string `json:"userid"`
	OpenUserid string `json:"open_userid"`
}

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 ToAgent struct {
	AgentId int64  `json:"agentid,omitempty"` //应用id
	ToUser  string `json:"touser,omitempty"`  //企业号中的用户帐号
	ToTag   string `json:"totag,omitempty"`   //企业号中的标签id,群发使用(推荐)
	ToParty string `json:"toparty,omitempty"` //企业号中的部门id,群发时使用。
}

func (*ToAgent) IsAgent

func (to *ToAgent) IsAgent() (bool, *ToAgent)

func (*ToAgent) IsGroup

func (to *ToAgent) IsGroup() (bool, *ToGroup)

func (*ToAgent) IsRoot

func (to *ToAgent) IsRoot() (bool, *ToRoot)

type ToGroup

type ToGroup struct {
	ChatId string `json:"chatid,omitempty"`
}

func (*ToGroup) IsAgent

func (to *ToGroup) IsAgent() (bool, *ToAgent)

func (*ToGroup) IsGroup

func (to *ToGroup) IsGroup() (bool, *ToGroup)

type ToRoot

type ToRoot struct {
}

func (*ToRoot) IsAgent

func (to *ToRoot) IsAgent() (bool, *ToAgent)

func (*ToRoot) IsGroup

func (to *ToRoot) IsGroup() (bool, *ToGroup)

func (*ToRoot) IsRoot

func (to *ToRoot) IsRoot() (bool, *ToRoot)

type ToWho

type ToWho interface {
	IsGroup() (bool, *ToGroup)
	IsAgent() (bool, *ToAgent)
}

type UserIdReq added in v1.0.0

type UserIdReq struct {
	UseridList []string `json:"userid_list"`
}

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

func USGetInfoWithTicket(api *token.Api, ticket string) (*UserInfo, error)

USGetInfoWithTicket 获取访问用户敏感信息 自建应用与代开发应用可通过该接口获取成员授权的敏感字段 对于自建应用与代开发应用,敏感字段需要管理员在应用详情里选择,且成员oauth2授权时确认后才返回。 敏感字段包括:性别、头像、员工个人二维码、手机、邮箱、企业邮箱、地址。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?access_token=ACCESS_TOKEN

type UserInfoWithCode added in v1.0.0

type UserInfoWithCode struct {
	Userid string `json:"userid"`
	OpenId string `json:"openid"`
}

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

type Video

type Video struct {
	MediaId string `json:"media_id"`
	Title   string `json:"title"`
	Desc    string `json:"description"`
}

type Voice

type Voice struct {
	MediaId string `json:"media_id"`
}

type WechatChannels added in v1.0.0

type WechatChannels struct {
	Nickname string `json:"nickname"`
	Source   int    `json:"source"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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