appchat

package
v2.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package appchat 应用发送消息到群聊会话,企业微信接口:https://developer.work.weixin.qq.com/document/path/90248

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*context.Context
}

Client 接口实例

func NewClient

func NewClient(ctx *context.Context) *Client

NewClient 初始化实例

func (*Client) Send

func (r *Client) Send(apiName string, request interface{}) (*SendResponse, error)

Send 发送应用消息 @desc 实现企业微信发送应用消息接口:https://developer.work.weixin.qq.com/document/path/90248

func (*Client) SendImage

func (r *Client) SendImage(request SendImageRequest) (*SendResponse, error)

SendImage 发送图片消息

func (*Client) SendText

func (r *Client) SendText(request SendTextRequest) (*SendResponse, error)

SendText 发送文本消息

func (*Client) SendVoice

func (r *Client) SendVoice(request SendVoiceRequest) (*SendResponse, error)

SendVoice 发送语音消息

type ImageField

type ImageField struct {
	// 图片媒体文件id,可以调用上传临时素材接口获取
	MediaID string `json:"media_id"`
}

ImageField 图片消息参数

type SendImageRequest

type SendImageRequest struct {
	*SendRequestCommon
	Image ImageField `json:"image"`
}

SendImageRequest 发送图片消息的请求

type SendRequestCommon

type SendRequestCommon struct {
	// 群聊id
	ChatID string `json:"chatid"`
	// 消息类型
	MsgType string `json:"msgtype"`
	// 表示是否是保密消息,0表示否,1表示是,默认0
	Safe int `json:"safe"`
}

SendRequestCommon 发送应用推送消息请求公共参数

type SendResponse

type SendResponse struct {
	util.CommonError
}

SendResponse 发送应用消息响应参数

type SendTextRequest

type SendTextRequest struct {
	*SendRequestCommon
	Text TextField `json:"text"`
}

SendTextRequest 发送文本消息的请求

type SendVoiceRequest

type SendVoiceRequest struct {
	*SendRequestCommon
	Voice VoiceField `json:"voice"`
}

SendVoiceRequest 发送语音消息的请求

type TextField

type TextField struct {
	// 消息内容,最长不超过2048个字节
	Content string `json:"content"`
}

TextField 文本消息参数

type VoiceField

type VoiceField struct {
	// 语音文件id,可以调用上传临时素材接口获取
	MediaID string `json:"media_id"`
}

VoiceField 语音消息参数

Jump to

Keyboard shortcuts

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