1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-06 21:52:27 +08:00
This commit is contained in:
houseme
2024-07-19 12:04:04 +08:00
parent ba0a1477eb
commit d8fde54f2d
118 changed files with 974 additions and 867 deletions

View File

@@ -2,10 +2,10 @@ package syncmsg
// BaseMessage 接收消息
type BaseMessage struct {
MsgID string `json:"msgid"` // 消息ID
OpenKFID string `json:"open_kfid"` // 客服帐号IDmsgtypeevent该字段不返回
ExternalUserID string `json:"external_userid"` // 客户UserIDmsgtypeevent该字段不返回
ReceptionistUserID string `json:"servicer_userid"` // 接待客服userID
MsgID string `json:"msgid"` // 消息 ID
OpenKFID string `json:"open_kfid"` // 客服帐号 IDmsgtypeevent该字段不返回
ExternalUserID string `json:"external_userid"` // 客户 UserIDmsgtypeevent该字段不返回
ReceptionistUserID string `json:"servicer_userid"` // 接待客服 userID
SendTime uint64 `json:"send_time"` // 消息发送时间
Origin uint32 `json:"origin"` // 消息来源。3-微信客户发送的消息 4-系统推送的事件消息 5-接待人员在企业微信客户端发送的消息
}
@@ -16,7 +16,7 @@ type Text struct {
MsgType string `json:"msgtype"` // 消息类型此时固定为text
Text struct {
Content string `json:"content"` // 文本内容
MenuID string `json:"menu_id"` // 客户点击菜单消息触发的回复消息中附带的菜单ID
MenuID string `json:"menu_id"` // 客户点击菜单消息,触发的回复消息中附带的菜单 ID
} `json:"text"` // 文本消息
}
@@ -25,7 +25,7 @@ type Image struct {
BaseMessage
MsgType string `json:"msgtype"` // 消息类型此时固定为image
Image struct {
MediaID string `json:"media_id"` // 图片文件ID
MediaID string `json:"media_id"` // 图片文件 ID
} `json:"image"` // 图片消息
}
@@ -34,7 +34,7 @@ type Voice struct {
BaseMessage
MsgType string `json:"msgtype"` // 消息类型此时固定为voice
Voice struct {
MediaID string `json:"media_id"` // 语音文件ID
MediaID string `json:"media_id"` // 语音文件 ID
} `json:"voice"` // 语音消息
}
@@ -43,7 +43,7 @@ type Video struct {
BaseMessage
MsgType string `json:"msgtype"` // 消息类型此时固定为video
Video struct {
MediaID string `json:"media_id"` // 文件ID
MediaID string `json:"media_id"` // 文件 ID
} `json:"video"` // 视频消息
}
@@ -52,7 +52,7 @@ type File struct {
BaseMessage
MsgType string `json:"msgtype"` // 消息类型此时固定为file
File struct {
MediaID string `json:"media_id"` // 文件ID
MediaID string `json:"media_id"` // 文件 ID
} `json:"file"` // 文件消息
}
@@ -94,9 +94,9 @@ type MiniProgram struct {
BaseMessage
MsgType string `json:"msgtype"` // 消息类型此时固定为miniprogram
MiniProgram struct {
AppID string `json:"appid"` // 小程序appid必须是关联到企业的小程序应用
Title string `json:"title"` // 小程序消息标题最多64个字节超过会自动截断
ThumbMediaID string `json:"thumb_media_id"` // 小程序消息封面的mediaid封面图建议尺寸为520*416
AppID string `json:"appid"` // 小程序 appid必须是关联到企业的小程序应用
Title string `json:"title"` // 小程序消息标题,最多 64 个字节,超过会自动截断
ThumbMediaID string `json:"thumb_media_id"` // 小程序消息封面的 mediaid封面图建议尺寸为 520*416
PagePath string `json:"pagepath"` // 点击消息卡片后进入的小程序页面路径
} `json:"miniprogram"` // 小程序消息
}
@@ -116,11 +116,11 @@ type EnterSessionEvent struct {
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
OpenKFID string `json:"open_kfid"` // 客服账号 ID
ExternalUserID string `json:"external_userid"` // 客户 UserID
Scene string `json:"scene"` // 进入会话的场景值,获取客服帐号链接开发者自定义的场景值
SceneParam string `json:"scene_param"` // 进入会话的自定义参数获取客服帐号链接返回的url开发者按规范拼接的scene_param参数
WelcomeCode string `json:"welcome_code"` // 如果满足发送欢迎语条件条件为1. 企业没有在管理端配置了原生欢迎语2. 用户在过去48小时里未收过欢迎语且未向该用户发过消息会返回该字段。可用该welcome_code调用发送事件响应消息接口给客户发送欢迎语。
SceneParam string `json:"scene_param"` // 进入会话的自定义参数,获取客服帐号链接返回的 url开发者按规范拼接的 scene_param 参数
WelcomeCode string `json:"welcome_code"` // 如果满足发送欢迎语条件条件为1. 企业没有在管理端配置了原生欢迎语2. 用户在过去 48 小时里未收过欢迎语,且未向该用户发过消息),会返回该字段。可用该 welcome_code 调用发送事件响应消息接口给客户发送欢迎语。
} `json:"event"` // 事件消息
}
@@ -130,10 +130,10 @@ type MsgSendFailEvent struct {
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-未知原因 1-客服账号已删除 2-应用已关闭 4-会话已过期超过48小时 5-会话已关闭 6-超过5条限制 7-未绑定视频号 8-主体未验证 9-未绑定视频号且主体未验证 10-用户拒收
OpenKFID string `json:"open_kfid"` // 客服账号 ID
ExternalUserID string `json:"external_userid"` // 客户 UserID
FailMsgID string `json:"fail_msgid"` // 发送失败的消息 msgid
FailType uint32 `json:"fail_type"` // 失败类型。0-未知原因 1-客服账号已删除 2-应用已关闭 4-会话已过期,超过 48 小时 5-会话已关闭 6-超过 5 条限制 7-未绑定视频号 8-主体未验证 9-未绑定视频号且主体未验证 10-用户拒收
} `json:"event"` // 事件消息
}
@@ -143,8 +143,8 @@ type ReceptionistStatusChangeEvent struct {
MsgType string `json:"msgtype"` // 消息类型此时固定为event
Event struct {
EventType string `json:"event_type"` // 事件类型。此处固定为servicer_status_change
ReceptionistUserID string `json:"servicer_userid"` // 客服人员userid
OpenKFID string `json:"open_kfid"` // 客服帐号ID
ReceptionistUserID string `json:"servicer_userid"` // 客服人员 userid
OpenKFID string `json:"open_kfid"` // 客服帐号 ID
Status uint32 `json:"status"` // 状态类型。1-接待中 2-停止接待
} `json:"event"`
}
@@ -155,11 +155,11 @@ type SessionStatusChangeEvent struct {
MsgType string `json:"msgtype"` // 消息类型此时固定为event
Event struct {
EventType string `json:"event_type"` // 事件类型。此处固定为session_status_change
OpenKFID string `json:"open_kfid"` // 客服账号ID
ExternalUserID string `json:"external_userid"` // 客户UserID
OpenKFID string `json:"open_kfid"` // 客服账号 ID
ExternalUserID string `json:"external_userid"` // 客户 UserID
ChangeType uint32 `json:"change_type"` // 变更类型。1-从接待池接入会话 2-转接会话 3-结束会话
OldReceptionistUserID string `json:"old_servicer_userid"` // 老的客服人员userid。仅change_type为2和3有值
NewReceptionistUserID string `json:"new_servicer_userid"` // 新的客服人员userid。仅change_type为1和2有值
MsgCode string `json:"msg_code"` // 用于发送事件响应消息的code仅change_type为1和3会返回该字段。可用该msg_code调用发送事件响应消息接口给客户发送回复语或结束语。
OldReceptionistUserID string `json:"old_servicer_userid"` // 老的客服人员 userid。仅 change_type 为 2 和 3 有值
NewReceptionistUserID string `json:"new_servicer_userid"` // 新的客服人员 userid。仅 change_type 为 1 和 2 有值
MsgCode string `json:"msg_code"` // 用于发送事件响应消息的 code change_type 为 1 和 3 时,会返回该字段。可用该 msg_code 调用发送事件响应消息接口给客户发送回复语或结束语。
} `json:"event"` // 事件消息
}

View File

@@ -4,10 +4,10 @@ import "encoding/json"
// Message 同步的消息内容
type Message struct {
MsgID string `json:"msgid"` // 消息ID
OpenKFID string `json:"open_kfid"` // 客服帐号ID
ExternalUserID string `json:"external_userid"` // 客户UserID
ReceptionistUserID string `json:"servicer_userid"` // 接待客服userID
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-系统推送的消 息
MsgType string `json:"msgtype"` // 消息类型