wechat

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BotMsgTypeText     = "text"
	BotMsgTypeMarkdown = "markdown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BotMsgContent

type BotMsgContent struct {
	MsgType  string   `json:"msgtype"`
	Text     *Content `json:"text,omitempty"`
	Markdown *Content `json:"markdown,omitempty"`
}

type Content

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

type CustomerMsg

type CustomerMsg struct {
	ToUser  string `json:"touser"`
	MsgType string `json:"msgtype"`
}

type CustomerMsgImage

type CustomerMsgImage struct {
	CustomerMsg
	Image MsgImage `json:"image"`
}
type CustomerMsgLink struct {
	CustomerMsg
	Link MsgLink `json:"link"`
}

type CustomerMsgText

type CustomerMsgText struct {
	CustomerMsg
	Text Content `json:"text"`
}

type EnterpriseGroupMsg

type EnterpriseGroupMsg struct {
	ChatID  string  `json:"chatid"`
	MsgType string  `json:"msgtype"`
	Safe    int     `json:"safe"`
	Text    Content `json:"text"`
}

type MPMsgTemplate

type MPMsgTemplate struct {
	Touser     string `json:"touser"`
	TemplateID string `json:"template_id"`
	//Url             string      `json:"url"`
	//MiniProgram     MiniProgram `json:"miniprogram"`
	FormID string      `json:"form_id"`
	Data   interface{} `json:"data"`
}

type MiniProgram

type MiniProgram struct {
	AppID string `json:"appid"`
	Page  string `json:"page"`
}

type MsgCustomer

type MsgCustomer struct {
	Touser  string `json:"touser"`
	Msgtype string `json:"msgtype"`
	Text    string `json:"text"`
}

type MsgImage

type MsgImage struct {
	MediaID string `json:"media_id"`
}
type MsgLink struct {
	Title    string `json:"title"`
	Desc     string `json:"description"`
	Url      string `json:"url"`
	ThumbUrl string `json:"thumb_url"`
}

type MsgResp

type MsgResp struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
}

type MsgRespImage

type MsgRespImage struct {
	MsgResp
	MediaID string `json:"media_id"`
}

type MsgTemplate

type MsgTemplate struct {
	Touser          string      `json:"touser"`
	TemplateID      string      `json:"template_id"`
	Url             string      `json:"url"`
	MiniProgram     MiniProgram `json:"miniprogram"`
	FormID          string      `json:"form_id"`
	Data            interface{} `json:"data"`
	EmphasisKeyword string      `json:"emphasis_keyword"`
}

type MsgValue

type MsgValue struct {
	Value interface{} `json:"value"`
}

type ReqBotMsg

type ReqBotMsg struct {
	BotKey string
	BotMsgContent
}

type ReqMiniProgramSubscribeMsg

type ReqMiniProgramSubscribeMsg struct {
	AccessToken string
	SubscribeMsg
}

type Service

type Service struct {
	sptty.BaseService
	// contains filtered or unexported fields
}

func (*Service) GetAccessToken

func (s *Service) GetAccessToken(appID string, appSecret string) (string, error)

func (*Service) Init

func (s *Service) Init(app sptty.ISptty) error

func (*Service) PostGroupBotMsg

func (s *Service) PostGroupBotMsg(req *ReqBotMsg) error

企业微信群机器人消息推送

func (*Service) SendCustomerMsg

func (s *Service) SendCustomerMsg(token string, body interface{}) error

func (*Service) SendMPTemplateMsg

func (s *Service) SendMPTemplateMsg(token string, openid string, templateid string, page string, formid string, data interface{}) error

func (*Service) SendMiniProgramSubscribeMsg

func (s *Service) SendMiniProgramSubscribeMsg(req *ReqMiniProgramSubscribeMsg) error

小程序订阅消息

func (*Service) ServiceName

func (s *Service) ServiceName() string

type SubscribeMsg

type SubscribeMsg struct {
	Touser           string              `json:"touser"`
	TemplateID       string              `json:"template_id"`
	Page             string              `json:"page,omitempty"`
	MiniprogramState string              `json:"miniprogram_state,omitempty"`
	Lang             string              `json:"lang,omitempty"`
	Data             map[string]MsgValue `json:"data"`
}

type TemplateValue

type TemplateValue struct {
	Value string `json:"value"`
}

type TokenResp

type TokenResp struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
}

Jump to

Keyboard shortcuts

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