Documentation ¶
Index ¶
- Constants
- type AgentItem
- type AllowPartys
- type AllowTags
- type AllowUserinfos
- type ButtonItem
- type CreateMenuReq
- type CustomAppManager
- func (manager *CustomAppManager) CreateMenu(req CreateMenuReq, agentid string) (*commons.CommonError, error)
- func (manager *CustomAppManager) DeleteMenu(agentid string) (*commons.CommonError, error)
- func (manager *CustomAppManager) GetAgentDetail(agentid string) (*GetAgentDetailResp, error)
- func (manager *CustomAppManager) GetAgentList() (*GetAgentListResp, error)
- func (manager *CustomAppManager) GetMenu(agentid string) (*GetMenuResp, error)
- func (manager *CustomAppManager) SetAgent(req SetAgentReq) (*commons.CommonError, error)
- type GetAgentDetailResp
- type GetAgentListResp
- type GetMenuResp
- type MenuType
- type SetAgentReq
Constants ¶
const ( GetAgentDetailURL string = "https://qyapi.weixin.qq.com/cgi-bin/agent/get" GetAgentListURL string = "https://qyapi.weixin.qq.com/cgi-bin/agent/list" SetAgentURL string = "https://qyapi.weixin.qq.com/cgi-bin/agent/set" )
自建应用的方法实现
const ( CreateMenuURL string = "https://qyapi.weixin.qq.com/cgi-bin/menu/create" GetMenuURL string = "https://qyapi.weixin.qq.com/cgi-bin/menu/get" DeleteMenuURL string = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete" )
自建应用自定义菜单接口
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentItem ¶
type AgentItem struct { AgentID int `json:"agentid"` // 企业应用id Name string `json:"name"` // 企业应用名称 SquareLogoURL string `json:"square_logo_url"` // 企业应用方形头像 }
AgentItem 应用项目
type AllowUserinfos ¶
type AllowUserinfos struct { Users []struct { UserID string `json:"userid"` } `json:"user"` }
AllowUserinfos 允许用户信息列表
type ButtonItem ¶
type ButtonItem struct { Type MenuType `json:"type,omitempty"` // 菜单的响应动作类型 Name string `json:"name"` // 菜单的名字。不能为空,主菜单不能超过16字节,子菜单不能超过40字节。 Key string `json:"key,omitempty"` // 菜单KEY值,用于消息接口推送,不超过128字节 Url string `json:"url,omitempty"` // 网页链接,成员点击菜单可打开链接,不超过1024字节。为了提高安全性,建议使用https的url PagePath string `json:"pagepath,omitempty"` // 小程序的页面路径 AppID string `json:"appid,omitempty"` // 小程序的appid(仅与企业绑定的小程序可配置) SubButton []ButtonItem `json:"sub_button,omitempty"` // 二级菜单数组,个数应为1~5个 }
ButtonItem 菜单选项
type CreateMenuReq ¶
type CreateMenuReq struct {
Button []ButtonItem `json:"button"`
}
CreateMenuReq 创建菜单参数请求
type CustomAppManager ¶
type CustomAppManager struct {
// contains filtered or unexported fields
}
CustomAppManager 自建应用管理
func NewCustomAppManager ¶
func NewCustomAppManager(corpid string, agentid string, secret string, tokenStore *tokens.AccessTokenStore) *CustomAppManager
NewCustomAppManager 返回一个manager的实例
func (*CustomAppManager) CreateMenu ¶
func (manager *CustomAppManager) CreateMenu(req CreateMenuReq, agentid string) (*commons.CommonError, error)
CreateMenu 创建菜单 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90231
func (*CustomAppManager) DeleteMenu ¶
func (manager *CustomAppManager) DeleteMenu(agentid string) (*commons.CommonError, error)
DeleteMenu 删除菜单 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90233
func (*CustomAppManager) GetAgentDetail ¶
func (manager *CustomAppManager) GetAgentDetail(agentid string) (*GetAgentDetailResp, error)
GetAgentDetail 获取指定的应用详情 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90227
func (*CustomAppManager) GetAgentList ¶
func (manager *CustomAppManager) GetAgentList() (*GetAgentListResp, error)
GetAgentList 获取access_token对应的应用列表 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90227
func (*CustomAppManager) GetMenu ¶
func (manager *CustomAppManager) GetMenu(agentid string) (*GetMenuResp, error)
GetMenu 获取菜单 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90232
func (*CustomAppManager) SetAgent ¶
func (manager *CustomAppManager) SetAgent(req SetAgentReq) (*commons.CommonError, error)
SetAgent 设置自建应用 参考 https://open.work.weixin.qq.com/api/doc/90000/90135/90228
type GetAgentDetailResp ¶
type GetAgentDetailResp struct { commons.CommonError AgentID string `json:"agentid"` // 企业应用id Name string `json:"name"` // 企业应用名称 SquareLogoURL string `json:"square_logo_url"` // 企业应用方形头像 Description string `json:"description"` // 企业应用详情 AllowUserinfos `json:"allow_userinfos"` // 企业应用可见范围(人员),其中包括userid AllowPartys `json:"allow_partys"` // 企业应用可见范围(部门) AllowTags `json:"allow_tags"` // 企业应用可见范围(标签) Close int `json:"close"` // 企业应用是否被停用 RedirectDomain string `json:"redirect_domain"` // 企业应用可信域名 ReportLocationFlag int `json:"report_location_flag"` // 企业应用是否打开地理位置上报 0:不上报;1:进入会话上报; IsReportenter int `json:"isreportenter"` // 是否上报用户进入应用事件。0:不接收;1:接收 HomeURL string `json:"home_url"` // 应用主页url }
GetAgentDetailResp 获取指定的应用详情响应
type GetAgentListResp ¶
type GetAgentListResp struct { commons.CommonError AgentList []AgentItem `json:"agentlist"` // 当前凭证可访问的应用列表 }
GetAgentListResp 获取access_token对应的应用列表响应
type GetMenuResp ¶
type GetMenuResp struct { commons.CommonError Button []ButtonItem `json:"button"` }
GetMenuResp 获取菜单响应
type MenuType ¶
type MenuType string
const ( Click MenuType = "click" // 点击推事件 View MenuType = "view" // 跳转URL ScancodePush MenuType = "scancode_push" // 扫码推事件 ScancodeWaitMsg MenuType = "scancode_waitmsg" // 扫码推事件 且弹出“消息接收中”提示框 PicSysPhoto MenuType = "pic_sysphoto" // 弹出系统拍照发图 PicPhotoOrAlbum MenuType = "pic_photo_or_album" // 弹出拍照或者相册发图 PicWeixin MenuType = "pic_weixin" // 弹出企业微信相册发图器 LocationSelect MenuType = "location_select" // 弹出地理位置选择器 ViewMiniProgram MenuType = "view_miniprogram" // 跳转到小程序 )
自定义菜单接口可实现多种类型按钮,枚举
type SetAgentReq ¶
type SetAgentReq struct { AgentID string `json:"agentid"` // 企业应用id ReportLocationFlag int `json:"report_location_flag,omitempty"` // 企业应用是否打开地理位置上报 0:不上报;1:进入会话上报; Name string `json:"name,omitempty"` // 企业应用名称 Description string `json:"description,omitempty"` // 企业应用详情 HomeURL string `json:"home_url,omitempty"` // 应用主页url RedirectDomain string `json:"redirect_domain,omitempty"` // 企业应用可信域名 IsReportenter int `json:"isreportenter,omitempty"` // 是否上报用户进入应用事件。0:不接收;1:接收 LogoMediaID string `json:"logo_mediaid,omitempty"` // 企业应用头像的mediaid,通过素材管理接口上传图片获得mediaid,上传后会自动裁剪成方形和圆形两个头像 }
SetAgentReq 设置应用请求