syncmsg

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMessage

type BaseMessage struct {
	MsgID              string `json:"msgid"`           // 消息ID
	OpenKFID           string `json:"open_kfid"`       // 客服帐号ID
	ExternalUserID     string `json:"external_userid"` // 客户UserID
	ReceptionistUserID string `json:"servicer_userid"` // 接待客服userID
	SendTime           uint64 `json:"send_time"`       // 消息发送时间
	Origin             uint32 `json:"origin"`          // 消息来源。3-客户回复的消息 4-系统推送的消息 5-客服回复消息
}

BaseMessage 接收消息

type EnterSessionEvent

type EnterSessionEvent struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:event
	Event   struct {
		EventType      string `json:"event_type"`      // 事件类型。此处固定为:enter_session
		OpenKFID       string `json:"open_kfid"`       // 客服账号ID
		ExternalUserID string `json:"external_userid"` // 客户UserID
		Scene          string `json:"scene"`           // 进入会话的场景值,获取客服帐号链接开发者自定义的场景值
	} `json:"event"` // 事件消息
}

EnterSessionEvent 用户进入会话事件

type Event

type Event struct {
	ToUserName string `json:"to_user_name"` // 微信客服组件ID
	CreateTime int    `json:"create_time"`  // 消息创建时间,unix时间戳
	MsgType    string `json:"msgtype"`      // 消息的类型,此时固定为 event
	Event      string `json:"event"`        // 事件的类型,此时固定为 kf_msg_or_event
	Token      string `json:"token"`        // 调用拉取消息接口时,需要传此token,用于校验请求的合法性
}

type EventMessage

type EventMessage struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:event
	Event   struct {
		EventType string `json:"event_type"` // 事件类型
	} `json:"event"` // 事件消息
}

EventMessage 事件消息

type File

type File struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:file
	File    struct {
		MediaID string `json:"media_id"` // 文件ID
	} `json:"file"` // 文件消息
}

File 文件消息

type Image

type Image struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:image
	Image   struct {
		MediaID string `json:"media_id"` // 图片文件ID
	} `json:"image"` // 图片消息
}

Image 图片消息

type Location

type Location struct {
	BaseMessage
	MsgType  string `json:"msgtype"` // 消息类型,此时固定为:location
	Location struct {
		Latitude  float32 `json:"latitude"`  // 纬度
		Longitude float32 `json:"longitude"` // 经度
		Name      string  `json:"name"`      // 位置名
		Address   string  `json:"address"`   // 地址详情说明
	} `json:"location"` // 地理位置消息
}

Location 地理位置消息

type Message

type Message struct {
	MsgID          string `json:"msgid"`           // 消息ID
	OpenKFID       string `json:"open_kfid"`       // 客服帐号ID
	ExternalUserID string `json:"external_userid"` // 客户UserID
	SendTime       uint64 `json:"send_time"`       // 消息发送时间
	Origin         uint32 `json:"origin"`          // 消息来源。3-客户回复的消息 4-系统推送的消 息
	MsgType        string `json:"msgtype"`         // 消息类型
	EventType      string `json:"event_type"`      // 事件类型
	OriginData     []byte `json:"origin_data"`     // 原始数据内容
}

Message 同步的消息内容

func (Message) GetEnterSessionEvent

func (r Message) GetEnterSessionEvent() (info EnterSessionEvent, err error)

GetEnterSessionEvent 用户进入会话事件

func (Message) GetFileMessage

func (r Message) GetFileMessage() (info File, err error)

GetFileMessage 获取文件消息

func (Message) GetImageMessage

func (r Message) GetImageMessage() (info Image, err error)

GetImageMessage 获取图片消息

func (Message) GetLocationMessage

func (r Message) GetLocationMessage() (info Location, err error)

GetLocationMessage 获取文件消息

func (Message) GetMsgSendFailEvent

func (r Message) GetMsgSendFailEvent() (info MsgSendFailEvent, err error)

GetMsgSendFailEvent 消息发送失败事件

func (Message) GetOriginMessage

func (r Message) GetOriginMessage() (info []byte)

GetOriginMessage 获取原始消息

func (Message) GetTextMessage

func (r Message) GetTextMessage() (info Text, err error)

GetTextMessage 获取文本消息

func (Message) GetVideoMessage

func (r Message) GetVideoMessage() (info Video, err error)

GetVideoMessage 获取视频消息

func (Message) GetVoiceMessage

func (r Message) GetVoiceMessage() (info Voice, err error)

GetVoiceMessage 获取语音消息

type MsgSendFailEvent

type MsgSendFailEvent struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:event
	Event   struct {
		EventType      string `json:"event_type"`      // 事件类型。此处固定为:msg_send_fail
		OpenKFID       string `json:"open_kfid"`       // 客服账号ID
		ExternalUserID string `json:"external_userid"` // 客户UserID
		FailMsgID      string `json:"fail_msgid"`      // 发送失败的消息msgid
		FailType       uint32 `json:"fail_type"`       // 失败类型。0-未知原因 10-用户拒收
	} `json:"event"` // 事件消息
}

MsgSendFailEvent 消息发送失败事件

type Text

type Text struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:text
	Text    struct {
		Content string `json:"content"` // 文本内容
		MenuID  string `json:"menu_id"` // 客户点击菜单消息,触发的回复消息中附带的菜单ID
	} `json:"text"` // 文本消息
}

Text 文本消息

type Video

type Video struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:video
	Video   struct {
		MediaID string `json:"media_id"` // 文件ID
	} `json:"video"` // 视频消息
}

Video 视频消息

type Voice

type Voice struct {
	BaseMessage
	MsgType string `json:"msgtype"` // 消息类型,此时固定为:voice
	Voice   struct {
		MediaID string `json:"media_id"` // 语音文件ID
	} `json:"voice"` // 语音消息
}

Voice 语音消息

Jump to

Keyboard shortcuts

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