Documentation ¶
Index ¶
- Constants
- func CmdWorkSendApp(arg *CmdWorkSendAppParams) error
- func CmdWorkSendAppChat(arg *CmdWorkSendAppChatParams) error
- func CmdWorkSendCustomer(arg *CmdWorkSendCustomerParams) error
- func CmdWorkSendExternalContact(arg *CmdWorkSendExternalContactParams) error
- func CmdWorkSendLinkedCorp(arg *CmdWorkSendLinkedCorpParams) error
- func CmdWorkUndoApp(arg *CmdWorkUndoAppParams) error
- func SendAppChat(accessToken string, msg *AppChatMessage) error
- func UndoApp(accessToken string, msg *UndoAppMessage) error
- func ValidateAppChatMsgType(v string) error
- func ValidateAppMsgType(v string) error
- func ValidateAppTemplateCardType(v string) error
- func ValidateCustomerMsgType(v string) error
- func ValidateExternalContactMsgType(v string) error
- func ValidateLinkedCorpMsgType(v string) error
- type AppChatMessage
- type AppMessage
- type AppMessageResponse
- type CmdWorkSendAppChatParams
- type CmdWorkSendAppParams
- type CmdWorkSendCustomerParams
- type CmdWorkSendExternalContactParams
- type CmdWorkSendLinkedCorpParams
- type CmdWorkUndoAppParams
- type CustomerMessage
- type CustomerMessageResponse
- type ExternalContactMessage
- type ExternalContactMessageResponse
- type FileMeta
- type ImageMeta
- type LinkMeta
- type LinkedCorpMessage
- type LinkedCorpMessageResponse
- type LocationMeta
- type MarkdownMeta
- type MiniProgramMeta
- type MiniProgramNoticeMeta
- type MpNewsArticle
- type MpNewsMeta
- type MsgMenuClick
- type MsgMenuItem
- type MsgMenuMeta
- type MsgMenuMiniProgram
- type MsgMenuText
- type MsgMenuView
- type NewsArticle
- type NewsMeta
- type NoticeContentItem
- type TemplateCardMeta
- type TextCardMeta
- type TextMeta
- type TplButtonItem
- type TplButtonOptionItem
- type TplButtonSelection
- type TplCardAction
- type TplCardActionItem
- type TplCardActionMenu
- type TplCardEmphasisContent
- type TplCardHorizontalContentItem
- type TplCardImage
- type TplCardJumpItem
- type TplCardMainTitle
- type TplCardQuoteArea
- type TplCardSource
- type TplCardTextNotice
- type TplCheckbox
- type TplCheckboxOptionItem
- type TplImageTextArea
- type TplSelectItem
- type TplSelectOptionItem
- type TplSubmitButton
- type TplVerticalContentItem
- type UndoAppMessage
- type UndoAppMessageResponse
- type VideoMeta
- type VoiceMeta
Constants ¶
const ( AppMsgTypeText = "text" // 文本消息 AppMsgTypeImage = "image" // 图片消息 AppMsgTypeVoice = "voice" // 语音消息 AppMsgTypeVideo = "video" // 视频消息 AppMsgTypeFile = "file" // 文件消息 AppMsgTypeTextCard = "textcard" // 文本卡片消息 AppMsgTypeNews = "news" // 图文消息 AppMsgTypeMpNews = "mpnews" // 图文消息 AppMsgTypeMarkdown = "markdown" // markdown消息 AppMsgTypeMiniProgramNotice = "miniprogram_notice" // 小程序通知消息 AppMsgTypeTemplateCard = "template_card" // 模板卡片消息 )
企业微信应用消息 类型
const ( AppTplCardTypeTextNotice = "text_notice" // 文本通知型 AppTplCardTypeNewsNotice = "news_notice" // 图文展示型 AppTplCardTypeButtonInteraction = "button_interaction" // 按钮交互型 AppTplCardTypeVoteInteraction = "vote_interaction" // 投票选择型 )
企业微信应用的模板卡片消息 类型
const ( AppChatMsgTypeText = "text" // 文本消息 AppChatMsgTypeImage = "image" // 图片消息 AppChatMsgTypeVoice = "voice" // 语音消息 AppChatMsgTypeVideo = "video" // 视频消息 AppChatMsgTypeFile = "file" // 文件消息 AppChatMsgTypeTextCard = "textcard" // 文本卡片消息 AppChatMsgTypeNews = "news" // 图文消息 AppChatMsgTypeMpNews = "mpnews" // 图文消息 AppChatMsgTypeMarkdown = "markdown" // markdown消息 )
企业微信群聊推送消息 类型
const ( CustomerMsgTypeText = "text" // 文本消息 CustomerMsgTypeImage = "image" // 图片消息 CustomerMsgTypeVoice = "voice" // 语音消息 CustomerMsgTypeVideo = "video" // 视频消息 CustomerMsgTypeFile = "file" // 文件消息 CustomerMsgTypeLink = "link" // 图文链接消息 CustomerMsgTypeMiniProgram = "miniprogram" // 小程序消息 CustomerMsgTypeMsgMenu = "msgmenu" // 菜单消息 CustomerMsgTypeLocation = "location" // 地理位置消息 )
企业微信客服消息 类型
const ( ExternalContactMsgTypeText = "text" // 文本消息 ExternalContactMsgTypeImage = "image" // 图片消息 ExternalContactMsgTypeVoice = "voice" // 语音消息 ExternalContactMsgTypeVideo = "video" // 视频消息 ExternalContactMsgTypeFile = "file" // 文件消息 ExternalContactMsgTypeNews = "news" // 图文消息 ExternalContactMsgTypeMpNews = "mpnews" // 图文消息 ExternalContactMsgTypeMiniProgramNotice = "miniprogram_notice" // 小程序通知消息 )
企业微信家校消息 类型
const ( LinkedCorpMsgTypeText = "text" // 文本消息 LinkedCorpMsgTypeImage = "image" // 图片消息 LinkedCorpMsgTypeVoice = "voice" // 语音消息 LinkedCorpMsgTypeVideo = "video" // 视频消息 LinkedCorpMsgTypeFile = "file" // 文件消息 LinkedCorpMsgTypeTextCard = "textcard" // 文本卡片消息 LinkedCorpMsgTypeNews = "news" // 图文消息 LinkedCorpMsgTypeMpNews = "mpnews" // 图文消息 LinkedCorpMsgTypeMarkdown = "markdown" // markdown消息 LinkedCorpMsgTypeMiniProgramNotice = "miniprogram_notice" // 小程序通知消息 )
企业微信互联企业消息 类型
Variables ¶
This section is empty.
Functions ¶
func CmdWorkSendApp ¶
func CmdWorkSendApp(arg *CmdWorkSendAppParams) error
CmdWorkSendApp 发送企业微信应用消息
func CmdWorkSendAppChat ¶
func CmdWorkSendAppChat(arg *CmdWorkSendAppChatParams) error
CmdWorkSendAppChat 发送企业微信群聊推送消息
func CmdWorkSendCustomer ¶
func CmdWorkSendCustomer(arg *CmdWorkSendCustomerParams) error
CmdWorkSendCustomer 发送微信客服消息
func CmdWorkSendExternalContact ¶
func CmdWorkSendExternalContact(arg *CmdWorkSendExternalContactParams) error
CmdWorkSendExternalContact 发送企业微信互联企业消息
func CmdWorkSendLinkedCorp ¶
func CmdWorkSendLinkedCorp(arg *CmdWorkSendLinkedCorpParams) error
CmdWorkSendLinkedCorp 发送企业微信互联企业消息
func CmdWorkUndoApp ¶
func CmdWorkUndoApp(arg *CmdWorkUndoAppParams) error
CmdWorkUndoApp 撤回企业微信应用消息
func SendAppChat ¶
func SendAppChat(accessToken string, msg *AppChatMessage) error
SendAppChat 发送企业微信群聊推送消息
func ValidateAppTemplateCardType ¶
ValidateAppTemplateCardType 验证
func ValidateCustomerMsgType ¶
ValidateCustomerMsgType 验证
func ValidateExternalContactMsgType ¶
ValidateExternalContactMsgType 验证
func ValidateLinkedCorpMsgType ¶
ValidateLinkedCorpMsgType 验证
Types ¶
type AppChatMessage ¶
type AppChatMessage struct { ChatID string `json:"chatid"` // 群聊id MsgType string `json:"msgtype"` // 消息类型 Safe int `json:"safe,omitempty"` // 表示是否是保密消息,0表示否,1表示是,默认0 Text *TextMeta `json:"text,omitempty"` // 文本消息 Image *ImageMeta `json:"image,omitempty"` // 图片消息 Voice *VoiceMeta `json:"voice,omitempty"` // 语音消息 Video *VideoMeta `json:"video,omitempty"` // 视频消息 File *FileMeta `json:"file,omitempty"` // 文件消息 TextCard *TextCardMeta `json:"textcard,omitempty"` // 文本卡片消息 News *NewsMeta `json:"news,omitempty"` // 图文消息 MpNews *MpNewsMeta `json:"mpnews,omitempty"` // 图文消息 Markdown *MarkdownMeta `json:"markdown,omitempty"` // markdown消息 }
AppChatMessage 企业微信群聊推送消息 touser、toparty、totag不能同时为空
type AppMessage ¶
type AppMessage struct { ToUser string `json:"touser,omitempty"` // 指定接收消息的成员,成员ID列表(多个接收者用‘|’分隔,最多支持1000个)。 特殊情况:指定为"@all",则向该企业应用的全部成员发送 ToParty string `json:"toparty,omitempty"` // 指定接收消息的部门,部门ID列表,多个接收者用‘|’分隔,最多支持100个。 当touser为"@all"时忽略本参数 ToTag string `json:"totag,omitempty"` // 指定接收消息的标签,标签ID列表,多个接收者用‘|’分隔,最多支持100个。 当touser为"@all"时忽略本参数 AgentID int64 `json:"agentid"` // 企业应用的id MsgType string `json:"msgtype"` // 消息类型 Safe int `json:"safe,omitempty"` // 表示是否是保密消息,0表示可对外分享,1表示不能分享且内容显示水印,默认为0 EnableIDTrans int `json:"enable_id_trans,omitempty"` // 表示是否开启id转译,0表示否,1表示是,默认0。仅第三方应用需要用到,企业自建应用可以忽略。 EnableDuplicateCheck int `json:"enable_duplicate_check,omitempty"` // 表示是否开启重复消息检查,0表示否,1表示是,默认0 DuplicateCheckInterval int `json:"duplicate_check_interval,omitempty"` // 表示是否重复消息检查的时间间隔,默认1800s,最大不超过4小时 Text *TextMeta `json:"text,omitempty"` // 文本消息 Image *ImageMeta `json:"image,omitempty"` // 图片消息 Voice *VoiceMeta `json:"voice,omitempty"` // 语音消息 Video *VideoMeta `json:"video,omitempty"` // 视频消息 File *FileMeta `json:"file,omitempty"` // 文件消息 TextCard *TextCardMeta `json:"textcard,omitempty"` // 文本卡片消息 News *NewsMeta `json:"news,omitempty"` // 图文消息 MpNews *MpNewsMeta `json:"mpnews,omitempty"` // 图文消息 Markdown *MarkdownMeta `json:"markdown,omitempty"` // markdown消息 MiniProgramNotice *MiniProgramNoticeMeta `json:"miniprogram_notice,omitempty"` // 小程序通知消息 TemplateCard *TemplateCardMeta `json:"template_card,omitempty"` // 模板卡片消息 }
AppMessage 企业微信应用消息 touser、toparty、totag不能同时为空
type AppMessageResponse ¶
type AppMessageResponse struct { weixin.ResponseMeta MsgID string `json:"msgid,omitempty"` // 消息id,用于撤回应用消息 ResponseCode string `json:"response_code,omitempty"` // 仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次 InvalidUser string `json:"invaliduser,omitempty"` // 不合法的userid,不区分大小写,统一转为小写 InvalidParty string `json:"invalidparty,omitempty"` // 不合法的partyid InvalidTag string `json:"invalidtag,omitempty"` // 不合法的标签id UnLicensedUser string `json:"unlicenseduser,omitempty"` // 没有基础接口许可(包含已过期)的userid }
AppMessageResponse 企业微信应用消息响应
func SendApp ¶
func SendApp(accessToken string, msg *AppMessage) (*AppMessageResponse, error)
SendApp 发送企业微信应用消息
func (AppMessageResponse) String ¶
func (t AppMessageResponse) String() string
type CmdWorkSendAppChatParams ¶
type CmdWorkSendAppChatParams struct { UserAgent string AccessToken string CorpID string CorpSecret string ChatID string MsgType string Safe int Data string }
func (*CmdWorkSendAppChatParams) Validate ¶
func (t *CmdWorkSendAppChatParams) Validate() error
type CmdWorkSendAppParams ¶
type CmdWorkSendAppParams struct { UserAgent string AccessToken string CorpID string CorpSecret string ToUser string ToParty string ToTag string AgentID int64 MsgType string Safe int EnableIDTrans int EnableDuplicateCheck int DuplicateCheckInterval int Data string }
func (*CmdWorkSendAppParams) Validate ¶
func (t *CmdWorkSendAppParams) Validate() error
type CmdWorkSendCustomerParams ¶
type CmdWorkSendCustomerParams struct { UserAgent string AccessToken string CorpID string CorpSecret string ToUser string OpenKfID string MsgID string MsgType string Data string }
func (*CmdWorkSendCustomerParams) Validate ¶
func (t *CmdWorkSendCustomerParams) Validate() error
type CmdWorkSendExternalContactParams ¶
type CmdWorkSendExternalContactParams struct { UserAgent string AccessToken string CorpID string CorpSecret string RecvScope int ToParentUserID []string ToStudentUserID []string ToParty []string ToAll int MsgType string AgentID int64 EnableIDTrans int EnableDuplicateCheck int DuplicateCheckInterval int Data string }
func (*CmdWorkSendExternalContactParams) Validate ¶
func (t *CmdWorkSendExternalContactParams) Validate() error
type CmdWorkSendLinkedCorpParams ¶
type CmdWorkSendLinkedCorpParams struct { UserAgent string AccessToken string CorpID string CorpSecret string ToUser []string ToParty []string ToTag []string ToAll int AgentID int64 MsgType string Safe int Data string }
func (*CmdWorkSendLinkedCorpParams) Validate ¶
func (t *CmdWorkSendLinkedCorpParams) Validate() error
type CmdWorkUndoAppParams ¶
type CustomerMessage ¶
type CustomerMessage struct { ToUser string `json:"touser"` OpenKfID string `json:"open_kfid"` MsgID string `json:"msgid,omitempty"` MsgType string `json:"msgtype"` Text *TextMeta `json:"text,omitempty"` Image *ImageMeta `json:"image,omitempty"` Voice *VoiceMeta `json:"voice,omitempty"` Video *VideoMeta `json:"video,omitempty"` File *FileMeta `json:"file,omitempty"` Link *LinkMeta `json:"link,omitempty"` MiniProgram *MiniProgramMeta `json:"miniprogram,omitempty"` MsgMenu *MsgMenuMeta `json:"msgmenu,omitempty"` Location *LocationMeta `json:"location,omitempty"` }
CustomerMessage 企业微信客服消息
type CustomerMessageResponse ¶
type CustomerMessageResponse struct { weixin.ResponseMeta // 消息ID。如果请求参数指定了msgid,则原样返回,否则系统自动生成并返回。 // 若指定msgid,开发者需确保客服账号内唯一,否则接口返回错误。 // 不多于32字节 字符串取值范围(正则表达式):[0-9a-zA-Z_-] MsgID string `json:"msgid,omitempty"` }
CustomerMessageResponse 企业微信客服消息的响应
func SendCustomer ¶
func SendCustomer(accessToken string, msg *CustomerMessage) (*CustomerMessageResponse, error)
SendCustomer 发送微信客服消息
func (CustomerMessageResponse) String ¶
func (t CustomerMessageResponse) String() string
type ExternalContactMessage ¶
type ExternalContactMessage struct { RecvScope int `json:"recv_scope,omitempty"` // 指定发送对象,0表示发送给家长,1表示发送给学生,2表示发送给家长和学生,默认为0。 ToParentUserID []string `json:"to_parent_userid,omitempty"` // recv_scope为0或2表示发送给对应的家长,recv_scope为1忽略,(最多支持1000个) ToStudentUserID []string `json:"to_student_userid,omitempty"` // recv_scope为0表示发送给学生的所有家长,recv_scope为1表示发送给学生,recv_scope为2表示发送给学生和学生的所有家长(最多支持1000个) ToParty []string `json:"to_party,omitempty"` // recv_scope为0表示发送给班级的所有家长,recv_scope为1表示发送给班级的所有学生,recv_scope为2表示发送给班级的所有学生和家长(最多支持100个) ToAll int `json:"toall,omitempty"` // 1表示字段生效,0表示字段无效。recv_scope为0表示发送给学校的所有家长,recv_scope为1表示发送给学校的所有学生,recv_scope为2表示发送给学校的所有学生和家长,默认为0 MsgType string `json:"msgtype"` // 消息类型 AgentID int64 `json:"agentid"` // 企业应用的id EnableIDTrans int `json:"enable_id_trans,omitempty"` // 表示是否开启id转译,0表示否,1表示是,默认0 EnableDuplicateCheck int `json:"enable_duplicate_check,omitempty"` // 表示是否开启重复消息检查,0表示否,1表示是,默认0 DuplicateCheckInterval int `json:"duplicate_check_interval,omitempty"` // 表示是否重复消息检查的时间间隔,默认1800s,最大不超过4小时 Text *TextMeta `json:"text,omitempty"` // 文本消息 Image *ImageMeta `json:"image,omitempty"` // 图片消息 Voice *VoiceMeta `json:"voice,omitempty"` // 语音消息 Video *VideoMeta `json:"video,omitempty"` // 视频消息 File *FileMeta `json:"file,omitempty"` // 文件消息 News *NewsMeta `json:"news,omitempty"` // 图文消息 MpNews *MpNewsMeta `json:"mpnews,omitempty"` // 图文消息 MiniProgramNotice *MiniProgramNoticeMeta `json:"miniprogram_notice,omitempty"` // 小程序通知消息 }
ExternalContactMessage 企业微信家校消息
type ExternalContactMessageResponse ¶
type ExternalContactMessageResponse struct { weixin.ResponseMeta InvalidParentUserID []string `json:"invalid_parent_userid,omitempty"` InvalidStudentUserID []string `json:"invalid_student_userid,omitempty"` InvalidParty []string `json:"invalid_party,omitempty"` }
func SendExternalContact ¶
func SendExternalContact(accessToken string, msg *ExternalContactMessage) (*ExternalContactMessageResponse, error)
SendExternalContact 发送企业微信家校消息
func (ExternalContactMessageResponse) String ¶
func (t ExternalContactMessageResponse) String() string
type LinkMeta ¶
type LinkMeta struct { Title string `json:"title"` Desc string `json:"desc,omitempty"` Url string `json:"url"` ThumbMediaID string `json:"thumb_media_id"` }
LinkMeta 图文链接
type LinkedCorpMessage ¶
type LinkedCorpMessage struct { ToUser []string `json:"touser,omitempty"` // 成员ID列表(消息接收者,最多支持1000个)。每个元素的格式为: corpid/userid,其中, corpid为该互联成员所属的企业,userid为该互联成员所属企业中的帐号。如果是本企业的成员,则直接传userid即可 ToParty []string `json:"toparty,omitempty"` // 部门ID列表,最多支持100个。partyid在互联圈子内唯一。每个元素都是字符串类型,格式为:linked_id/party_id,其中linked_id是互联id,party_id是在互联圈子中的部门id。如果是本企业的部门,则直接传party_id即可 ToTag []string `json:"totag,omitempty"` // 本企业的标签ID列表,最多支持100个 ToAll int `json:"toall,omitempty"` // 1表示发送给应用可见范围内的所有人(包括互联企业的成员),默认为0 AgentID int64 `json:"agentid"` // 企业应用的id,整型。可在应用的设置页面查看 MsgType string `json:"msgtype"` // 消息类型 Safe int `json:"safe,omitempty"` // 表示是否是保密消息,0表示否,1表示是,默认0 Text *TextMeta `json:"text,omitempty"` // 文本消息 Image *ImageMeta `json:"image,omitempty"` // 图片消息 Voice *VoiceMeta `json:"voice,omitempty"` // 语音消息 Video *VideoMeta `json:"video,omitempty"` // 视频消息 File *FileMeta `json:"file,omitempty"` // 文件消息 TextCard *TextCardMeta `json:"textcard,omitempty"` // 文本卡片消息 News *NewsMeta `json:"news,omitempty"` // 图文消息 MpNews *MpNewsMeta `json:"mpnews,omitempty"` // 图文消息 Markdown *MarkdownMeta `json:"markdown,omitempty"` // markdown消息 MiniProgramNotice *MiniProgramNoticeMeta `json:"miniprogram_notice,omitempty"` // 小程序通知消息 }
LinkedCorpMessage 企业微信互联企业消息
type LinkedCorpMessageResponse ¶
type LinkedCorpMessageResponse struct { weixin.ResponseMeta InvalidUser []string `json:"invaliduser,omitempty"` InvalidParty []string `json:"invalidparty,omitempty"` InvalidTag []string `json:"invalidtag,omitempty"` }
func SendLinkedCorp ¶
func SendLinkedCorp(accessToken string, msg *LinkedCorpMessage) (*LinkedCorpMessageResponse, error)
SendLinkedCorp 发送企业微信互联企业消息
func (LinkedCorpMessageResponse) String ¶
func (t LinkedCorpMessageResponse) String() string
type LocationMeta ¶
type LocationMeta struct { Name string `json:"name,omitempty"` Address string `json:"address,omitempty"` Latitude int `json:"latitude"` Longitude int `json:"longitude"` }
LocationMeta 地理位置消息
type MarkdownMeta ¶
type MarkdownMeta struct {
Content string `json:"content"` // markdown内容,最长不超过2048个字节,必须是utf8编码
}
MarkdownMeta markdown消息
type MiniProgramMeta ¶
type MiniProgramMeta struct { Title string `json:"title,omitempty"` AppID string `json:"appid"` PagePath string `json:"pagepath"` ThumbMediaID string `json:"thumb_media_id"` }
MiniProgramMeta 小程序消息
type MiniProgramNoticeMeta ¶
type MiniProgramNoticeMeta struct { AppID string `json:"appid"` // 小程序appid,必须是与当前应用关联的小程序 Page string `json:"page,omitempty"` // 点击消息卡片后的小程序页面,最长1024个字节,仅限本小程序内的页面。该字段不填则消息点击后不跳转。 Title string `json:"title"` // 消息标题,长度限制4-12个汉字(支持id转译) Description string `json:"description,omitempty"` // 消息描述,长度限制4-12个汉字(支持id转译) EmphasisFirstItem bool `json:"emphasis_first_item,omitempty"` // 是否放大第一个content_item ContentItem []NoticeContentItem `json:"content_item,omitempty"` // 消息内容键值对,最多允许10个item }
MiniProgramNoticeMeta 小程序通知消息 小程序通知消息只允许绑定了小程序的应用发送 不支持@all全员发送
type MpNewsArticle ¶
type MpNewsArticle struct { Title string `json:"title"` // 标题,不超过128个字节,超过会自动截断(支持id转译) ThumbMediaID string `json:"thumb_media_id"` // 图文消息缩略图的media_id Author string `json:"author,omitempty"` // 图文消息的作者,不超过64个字节 ContentSourceUrl string `json:"content_source_url,omitempty"` // 图文消息点击“阅读原文”之后的页面链接 Content string `json:"content"` // 图文消息的内容,支持html标签,不超过666 K个字节(支持id转译) Digest string `json:"digest,omitempty"` // 图文消息的描述,不超过512个字节,超过会自动截断(支持id转译) }
MpNewsArticle 图文
type MpNewsMeta ¶
type MpNewsMeta struct {
Articles []MpNewsArticle `json:"articles"` // 一个图文消息支持1到8条图文
}
MpNewsMeta 图文消息
type MsgMenuClick ¶
type MsgMenuItem ¶
type MsgMenuItem struct { Type string `json:"type"` Click *MsgMenuClick `json:"click,omitempty"` View *MsgMenuView `json:"view,omitempty"` MiniProgram *MsgMenuMiniProgram `json:"miniprogram,omitempty"` Text *MsgMenuText `json:"text,omitempty"` }
MsgMenuItem 菜单内容
type MsgMenuMeta ¶
type MsgMenuMeta struct { HeadContent string `json:"head_content,omitempty"` List []MsgMenuItem `json:"list"` TailContent string `json:"tail_content,omitempty"` }
MsgMenuMeta 菜单消息
type MsgMenuMiniProgram ¶
type MsgMenuText ¶
type MsgMenuText struct {
Content string `json:"content"`
}
type MsgMenuView ¶
type NewsArticle ¶
type NewsArticle struct { Title string `json:"title"` // 标题,不超过128个字节,超过会自动截断(支持id转译) Description string `json:"description,omitempty"` // 描述,不超过512个字节,超过会自动截断(支持id转译) Url string `json:"url,omitempty"` // 点击后跳转的链接 PicUrl string `json:"picurl,omitempty"` // 图文消息的图片链接 AppID string `json:"appid"` // 小程序appid,必须是与当前应用关联的小程序,appid和pagepath必须同时填写,填写后会忽略url字段 PagePath string `json:"pagepath"` // 点击消息卡片后的小程序页面,最长128字节,仅限本小程序内的页面 }
NewsArticle 图文
type NewsMeta ¶
type NewsMeta struct {
Articles []NewsArticle `json:"articles"` // 一个图文消息支持1到8条图文
}
NewsMeta 图文消息
type NoticeContentItem ¶
type NoticeContentItem struct { Key string `json:"key"` // 长度10个汉字以内 Value string `json:"value"` // 长度30个汉字以内(支持id转译) }
NoticeContentItem 消息内容键值对
type TemplateCardMeta ¶
type TemplateCardMeta struct { CardType string `json:"card_type"` // 模板卡片类型 Source *TplCardSource `json:"source,omitempty"` ActionMenu *TplCardActionMenu `json:"action_menu,omitempty"` TaskID string `json:"task_id,omitempty"` MainTitle *TplCardMainTitle `json:"main_title,omitempty"` QuoteArea *TplCardQuoteArea `json:"quote_area,omitempty"` EmphasisContent *TplCardEmphasisContent `json:"emphasis_content,omitempty"` SubTitleText string `json:"sub_title_text,omitempty"` HorizontalContentList []TplCardHorizontalContentItem `json:"horizontal_content_list,omitempty"` JumpList []TplCardJumpItem `json:"jump_list,omitempty"` CardAction *TplCardAction `json:"card_action,omitempty"` ImageTextArea *TplImageTextArea `json:"image_text_area,omitempty"` CardImage *TplCardImage `json:"card_image,omitempty"` VerticalContentList []TplVerticalContentItem `json:"vertical_content_list,omitempty"` ButtonSelection *TplButtonSelection `json:"button_selection,omitempty"` ButtonList []TplButtonItem `json:"button_list,omitempty"` Checkbox *TplCheckbox `json:"checkbox,omitempty"` SubmitButton *TplSubmitButton `json:"submit_button,omitempty"` SelectList []TplSelectItem `json:"select_list,omitempty"` }
TemplateCardMeta 模板卡片消息
type TextCardMeta ¶
type TextCardMeta struct { Title string `json:"title"` // 标题,不超过128个字节,超过会自动截断(支持id转译) Description string `json:"description"` // 描述,不超过512个字节,超过会自动截断(支持id转译) Url string `json:"url"` // 点击后跳转的链接。最长2048字节,请确保包含了协议头(http/https) BtnTxt string `json:"btntxt,omitempty"` // 按钮文字。 默认为“详情”, 不超过4个文字,超过自动截断。 }
TextCardMeta 文本卡片消息
type TextMeta ¶
type TextMeta struct {
Content string `json:"content"` // 消息内容,最长不超过2048个字节,超过将截断(支持id转译)
}
TextMeta 文本消息
type TplButtonItem ¶
type TplButtonItem struct { Text string `json:"text"` // 按钮文案,建议不超过10个字 Style int `json:"style,omitempty"` // 按钮样式,目前可填1~4,不填或错填默认1 Key string `json:"key,omitempty"` // 按钮key值,用户点击后,会产生回调事件将本参数作为EventKey返回,回调事件会带上该key值,最长支持1024字节,不可重复,button_list.type是0时必填 Type string `json:"type,omitempty"` // 按钮点击事件类型,0 或不填代表回调点击事件,1 代表跳转url Url string `json:"url,omitempty"` // 跳转事件的url,button_list.type是1时必填 }
TplButtonItem 按钮 按钮列表,列表长度不超过6
type TplButtonOptionItem ¶
type TplButtonOptionItem struct { ID string `json:"id"` // 下拉式的选择器选项的id,用户提交后,会产生回调事件,回调事件会带上该id值表示该选项,最长支持128字节,不可重复 Text string `json:"text"` // 下拉式的选择器选项的文案,建议不超过16个字 }
TplButtonOptionItem 下拉式的选择器选项
type TplButtonSelection ¶
type TplButtonSelection struct { QuestionKey string `json:"question_key"` // 下拉式的选择器的key,用户提交选项后,会产生回调事件,回调事件会带上该key值表示该题,最长支持1024字节 Title string `json:"title,omitempty"` // 下拉式的选择器左边的标题 OptionList []TplButtonOptionItem `json:"option_list"` // 选项列表,下拉选项不超过 10 个,最少1个 SelectedID string `json:"selected_id,omitempty"` // 默认选定的id,不填或错填默认第一个 }
TplButtonSelection 下拉式的选择器
type TplCardAction ¶
type TplCardAction struct { Type int `json:"type"` // 跳转事件类型,1 代表跳转url,2 代表打开小程序。text_notice卡片模版中该字段取值范围为[1,2] Url string `json:"url,omitempty"` // 跳转事件的url,card_action.type是1时必填 AppID string `json:"appid,omitempty"` // 跳转事件的小程序的appid,必须是与当前应用关联的小程序,card_action.type是2时必填 PagePath string `json:"pagepath,omitempty"` // 跳转事件的小程序的pagepath,card_action.type是2时选填 }
TplCardAction 整体卡片的点击跳转事件,text_notice必填本字段
type TplCardActionItem ¶
type TplCardActionItem struct { Text string `json:"text"` // 操作的描述文案 Key string `json:"key"` // 操作key值,用户点击后,会产生回调事件将本参数作为EventKey返回,回调事件会带上该key值,最长支持1024字节,不可重复 }
TplCardActionItem 操作
type TplCardActionMenu ¶
type TplCardActionMenu struct { Desc string `json:"desc,omitempty"` // 更多操作界面的描述 ActionList []TplCardActionItem `json:"action_list"` // 操作列表,列表长度取值范围为 [1, 3] }
TplCardActionMenu 卡片右上角更多操作按钮
type TplCardEmphasisContent ¶
type TplCardEmphasisContent struct { Title string `json:"title"` // 关键数据样式的数据内容,建议不超过14个字 Desc string `json:"desc"` // 关键数据样式的数据描述内容,建议不超过22个字 }
TplCardEmphasisContent 关键数据样式
type TplCardHorizontalContentItem ¶
type TplCardHorizontalContentItem struct { KeyName string `json:"keyname"` // 二级标题,建议不超过5个字 Value string `json:"value,omitempty"` // 二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字,(支持id转译) Type int `json:"type,omitempty"` // 链接类型,0或不填代表不是链接,1 代表跳转url,2 代表下载附件,3 代表点击跳转成员详情 Url string `json:"url,omitempty"` // 链接跳转的url,horizontal_content_list.type是1时必填 MediaID string `json:"media_id,omitempty"` // 附件的media_id,horizontal_content_list.type是2时必填 UserID string `json:"userid,omitempty"` // 成员详情的userid,horizontal_content_list.type是3时必填 }
TplCardHorizontalContentItem 二级标题+文本列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6
type TplCardImage ¶
type TplCardImage struct { Url string `json:"url"` // 图片的url AspectRatio float64 `json:"aspect_ratio"` // 图片的宽高比,宽高比要小于2.25,大于1.3,不填该参数默认1.3 }
TplCardImage 图片样式,news_notice类型的卡片,card_image和image_text_area两者必填一个字段,不可都不填
type TplCardJumpItem ¶
type TplCardJumpItem struct { Type int `json:"type,omitempty"` // 跳转链接类型,0或不填代表不是链接,1 代表跳转url,2 代表跳转小程序 Title string `json:"title"` // 跳转链接样式的文案内容,建议不超过18个字 Url string `json:"url,omitempty"` // 跳转链接的url,jump_list.type是1时必填 AppID string `json:"appid,omitempty"` // 跳转链接的小程序的appid,必须是与当前应用关联的小程序,jump_list.type是2时必填 PagePath string `json:"pagepath,omitempty"` // 跳转链接的小程序的pagepath,jump_list.type是2时选填 }
TplCardJumpItem 跳转指引样式的列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过3
type TplCardMainTitle ¶
type TplCardMainTitle struct { Title string `json:"title,omitempty"` // 一级标题,建议不超过36个字,文本通知型卡片本字段非必填,但不可本字段和sub_title_text都不填,(支持id转译) Desc string `json:"desc,omitempty"` // 标题辅助信息,建议不超过44个字,(支持id转译) }
TplCardMainTitle 一级标题
type TplCardQuoteArea ¶
type TplCardQuoteArea struct { Type int `json:"type"` // 引用文献样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序 Url string `json:"url"` // 点击跳转的url,quote_area.type是1时必填 AppID string `json:"appid,omitempty"` // 点击跳转的小程序的appid,必须是与当前应用关联的小程序,quote_area.type是2时必填 PagePath string `json:"pagepath,omitempty"` // 点击跳转的小程序的pagepath,quote_area.type是2时选填 Title string `json:"title"` // 引用文献样式的标题 QuoteText string `json:"quote_text"` // 引用文献样式的引用文案 }
TplCardQuoteArea 引用文献样式
type TplCardSource ¶
type TplCardSource struct { IconUrl string `json:"icon_url,omitempty"` // 来源图片的url,来源图片的尺寸建议为72*72 Desc string `json:"desc,omitempty"` // 来源图片的描述,建议不超过20个字,(支持id转译) DescColor int `json:"desc_color,omitempty"` // 来源文字的颜色,目前支持:0(默认) 灰色,1 黑色,2 红色,3 绿色 }
TplCardSource 卡片来源样式信息,不需要来源样式可不填写
type TplCardTextNotice ¶
type TplCardTextNotice struct { SelectList []TplSelectItem `json:"select_list,omitempty"` SubmitButton struct { Text string `json:"text"` Key string `json:"key"` } `json:"submit_button"` }
type TplCheckbox ¶
type TplCheckbox struct { QuestionKey string `json:"question_key"` // 选择题key值,用户提交选项后,会产生回调事件,回调事件会带上该key值表示该题,最长支持1024字节 OptionList []TplCheckboxOptionItem `json:"option_list"` // 选项list,选项个数不超过 20 个,最少1个 Mode int `json:"mode,omitempty"` // 选择题模式,单选:0,多选:1,不填默认0 }
TplCheckbox 选择题样式
type TplCheckboxOptionItem ¶
type TplCheckboxOptionItem struct { ID string `json:"id"` // 选项id,用户提交选项后,会产生回调事件,回调事件会带上该id值表示该选项,最长支持128字节,不可重复 Text string `json:"text"` // 选项文案描述,建议不超过17个字 IsChecked bool `json:"is_checked"` // 该选项是否要默认选中 }
TplCheckboxOptionItem 选项
type TplImageTextArea ¶
type TplImageTextArea struct { Type int `json:"type,omitempty"` // 左图右文样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序 Url string `json:"url,omitempty"` // 点击跳转的url,image_text_area.type是1时必填 Title string `json:"title,omitempty"` // 左图右文样式的标题 Desc string `json:"desc,omitempty"` // 左图右文样式的描述 AppID string `json:"appid,omitempty"` // 点击跳转的小程序的appid,必须是与当前应用关联的小程序,image_text_area.type是2时必填 PagePath string `json:"pagepath,omitempty"` // 点击跳转的小程序的pagepath,image_text_area.type是2时选填 ImageUrl string `json:"image_url"` // 左图右文样式的图片url }
TplImageTextArea 左图右文样式
type TplSelectItem ¶
type TplSelectItem struct { QuestionKey string `json:"question_key"` // 下拉式的选择器题目的key,用户提交选项后,会产生回调事件,回调事件会带上该key值表示该题,最长支持1024字节,不可重复 Title string `json:"title,omitempty"` // 下拉式的选择器上面的title SelectedID string `json:"selected_id,omitempty"` // 默认选定的id,不填或错填默认第一个 OptionList []TplSelectOptionItem `json:"option_list"` // 选项列表,下拉选项不超过 10 个,最少1个 }
TplSelectItem 下拉式的选择器列表,multiple_interaction类型的卡片该字段不可为空,一个消息最多支持 3 个选择器
type TplSelectOptionItem ¶
type TplSelectOptionItem struct { ID string `json:"id"` // 下拉式的选择器选项的id,用户提交选项后,会产生回调事件,回调事件会带上该id值表示该选项,最长支持128字节,不可重复 Text string `json:"text"` // 下拉式的选择器选项的文案,建议不超过16个字 }
TplSelectOptionItem 下拉式的选择器选项
type TplSubmitButton ¶
type TplSubmitButton struct { Text string `json:"text"` // 按钮文案,建议不超过10个字,不填默认为提交 Key string `json:"key"` // 提交按钮的key,会产生回调事件将本参数作为EventKey返回,最长支持1024字节 }
TplSubmitButton 提交按钮样式
type TplVerticalContentItem ¶
type TplVerticalContentItem struct { Title string `json:"title"` // 卡片二级标题,建议不超过38个字 Desc string `json:"desc,omitempty"` // 二级普通文本,建议不超过160个字 }
TplVerticalContentItem 卡片二级垂直内容,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过4
type UndoAppMessage ¶
type UndoAppMessage struct {
MsgID string `json:"msgid"` // 消息ID。从应用发送消息接口处获得
}
UndoAppMessage 撤回企业微信应用消息 可以撤回24小时内通过发送应用消息接口推送的消息,仅可撤回企业微信端的数据,微信插件端的数据不支持撤回。
type UndoAppMessageResponse ¶
type UndoAppMessageResponse struct {
weixin.ResponseMeta
}
UndoAppMessageResponse 企业微信撤回应用消息响应