Documentation
¶
Index ¶
- Constants
- func RSADecrypt(privateKey string, ciphertext []byte) ([]byte, error)
- func RSADecryptBase64(privateKey string, cryptoText string) ([]byte, error)
- type AgreeMessage
- type BaseMessage
- type CalendarMessage
- type CardMessage
- type ChatData
- type ChatMessage
- func (c ChatMessage) GetAgreeMessage() (msg AgreeMessage)
- func (c ChatMessage) GetCalendarMessage() (msg CalendarMessage)
- func (c ChatMessage) GetCardMessage() (msg CardMessage)
- func (c ChatMessage) GetChatRecordMessage() (msg ChatRecordMessage)
- func (c ChatMessage) GetCollectMessage() (msg CollectMessage)
- func (c ChatMessage) GetDocMessage() (msg DocMessage)
- func (c ChatMessage) GetEmotionMessage() (msg EmotionMessage)
- func (c ChatMessage) GetExternalRedPacketMessage() (msg ExternalRedPacketMessage)
- func (c ChatMessage) GetFileMessage() (msg FileMessage)
- func (c ChatMessage) GetImageMessage() (msg ImageMessage)
- func (c ChatMessage) GetLinkMessage() (msg LinkMessage)
- func (c ChatMessage) GetLocationMessage() (msg LocationMessage)
- func (c ChatMessage) GetMarkdownMessage() (msg MarkdownMessage)
- func (c ChatMessage) GetMeetingMessage() (msg MeetingMessage)
- func (c ChatMessage) GetMeetingVoiceCallMessage() (msg MeetingVoiceCallMessage)
- func (c ChatMessage) GetMixedMessage() (msg MixedMessage)
- func (c ChatMessage) GetNewsMessage() (msg NewsMessage)
- func (c ChatMessage) GetOriginMessage() (msg map[string]interface{})
- func (c ChatMessage) GetRawChatMessage() json.RawMessage
- func (c ChatMessage) GetRedpacketMessage() (msg RedPacketMessage)
- func (c ChatMessage) GetRevokeMessage() (msg RevokeMessage)
- func (c ChatMessage) GetSphFeedMessage() (msg SphFeedMessage)
- func (c ChatMessage) GetSwitchMessage() (msg SwitchMessage)
- func (c ChatMessage) GetTextMessage() (msg TextMessage)
- func (c ChatMessage) GetTodoMessage() (msg TodoMessage)
- func (c ChatMessage) GetVideoMessage() (msg VideoMessage)
- func (c ChatMessage) GetVoiceMessage() (msg VoiceMessage)
- func (c ChatMessage) GetVoipDocShareMessage() (msg VoipDocShareMessage)
- func (c ChatMessage) GetVoiptextMessage() (msg VoiptextMessage)
- func (c ChatMessage) GetVoteMessage() (msg VoteMessage)
- func (c ChatMessage) GetWeappMessage() (msg WeAppMessage)
- type ChatRawData
- type ChatRecord
- type ChatRecordMessage
- type Client
- type CollectDetail
- type CollectMessage
- type DemoFileData
- type DocMessage
- type EmotionMessage
- type Error
- type ExternalRedPacketMessage
- type FileMessage
- type ImageMessage
- type LinkMessage
- type LocationMessage
- type MarkdownMessage
- type MediaData
- type MeetingMessage
- type MeetingVoiceCall
- type MeetingVoiceCallMessage
- type MixedMessage
- type MixedMsg
- type News
- type NewsMessage
- type RedPacketMessage
- type RevokeMessage
- type SdkClient
- func (s *SdkClient) DecryptData(encryptRandomKey string, encryptMsg string, specificPrivateKey string) (msg ChatMessage, err error)
- func (s *SdkClient) Free()
- func (s *SdkClient) GetChatData(seq uint64, limit uint64, proxy string, passwd string, timeout int) ([]ChatData, error)
- func (s *SdkClient) GetContentFromSlice(slice *C.struct_Slice_t) []byte
- func (s *SdkClient) GetMediaData(indexBuf string, sdkFileId string, proxy string, passwd string, timeout int) (*MediaData, error)
- type ShareScreenData
- type SphFeedMessage
- type SwitchMessage
- type TextMessage
- type TodoMessage
- type VideoMessage
- type VoiceMessage
- type VoipDocShare
- type VoipDocShareMessage
- type VoiptextMessage
- type VoteMessage
- type WeAppMessage
Constants ¶
const ( SDKErrMsg = "sdk failed" SDKParamsErrMsg = "参数错误,请求参数错误" SDKNetworkErrMsg = "网络错误,网络请求错误" SDKParseErrMsg = "数据解析失败" SDKSystemErrMsg = "系统失败" SDKSecretErrMsg = "密钥错误导致加密失败" SDKFileIdErrMsg = "fileid错误" SDKDecryptErrMsg = "解密失败" SDKSecretMissErrMsg = "找不到消息加密版本的私钥,需要重新传入私钥对" SDKEncryptKeyErrMsg = "解析encrypt_key出错" SDKIPNotWhiteListErrMsg = "ip非法" SDKDataExpiredErrMsg = "数据过期" SDKTokenExpiredErrMsg = "证书过期" )
返回码 错误说明 10000 参数错误,请求参数错误 10001 网络错误,网络请求错误 10002 数据解析失败 10003 系统失败 10004 密钥错误导致加密失败 10005 fileid错误 10006 解密失败 10007 找不到消息加密版本的私钥,需要重新传入私钥对 10008 解析encrypt_key出错 10009 ip非法 10010 数据过期 10011 证书错误
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgreeMessage ¶
type AgreeMessage struct {
BaseMessage
Agree struct {
UserID string `json:"userid,omitempty"` // 同意/不同意协议者的userid,外部企业默认为external_userid。
AgreeTime int64 `json:"agree_time,omitempty"` // 同意/不同意协议的时间,utc时间,ms单位。
} `json:"agree,omitempty"`
}
AgreeMessage 同意会话聊天内容 类型为:agree(同意)、disagree(不同意)
type BaseMessage ¶
type BaseMessage struct {
MsgID string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。
Action string `json:"action,omitempty"` // 消息动作,目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型。
From string `json:"from,omitempty"` // 消息发送方id。同一企业内容为userid,非相同企业为external_userid。消息如果是机器人发出,也为external_userid。
ToList []string `json:"tolist,omitempty"` // 消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid。
RoomID string `json:"roomid,omitempty"` // 群聊消息的群id。如果是单聊则为空。
MsgTime int64 `json:"msgtime,omitempty"` // 消息发送时间戳,utc时间,ms单位。
MsgType string `json:"msgtype,omitempty"` // 消息类型,具体数据见消息注释内容
}
BaseMessage 会话存档基础消息
type CalendarMessage ¶
type CalendarMessage struct {
BaseMessage
Calendar struct {
Title string `json:"title,omitempty"` // 日程主题
CreatorName string `json:"creatorname,omitempty"` // 日程组织者
AttendeeName []string `json:"attendeename,omitempty"` // 日程参与人。数组,内容为String类型
StartTime int64 `json:"starttime,omitempty"` // 日程开始时间。Utc时间,单位秒
EndTime int64 `json:"endtime,omitempty"` // 日程结束时间。Utc时间,单位秒
Place string `json:"place,omitempty"` // 日程地点
Remarks string `json:"remarks,omitempty"` // 日程备注
} `json:"calendar,omitempty"`
}
CalendarMessage 日程消息 类型为:calendar
type CardMessage ¶
type CardMessage struct {
BaseMessage
Card struct {
CorpName string `json:"corpname,omitempty"` // 名片所有者所在的公司名称。
UserID string `json:"userid,omitempty"` // 名片所有者的id,同一公司是userid,不同公司是external_userid
} `json:"card,omitempty"`
}
CardMessage 名片 类型为:card
type ChatData ¶
type ChatData struct {
Seq uint64 `json:"seq,omitempty"` // 消息的seq值,标识消息的序号。再次拉取需要带上上次回包中最大的seq。Uint64类型,范围0-pow(2,64)-1
MsgId string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。
PublickeyVer uint32 `json:"publickey_ver,omitempty"` // 加密此条消息使用的公钥版本号。
EncryptRandomKey string `json:"encrypt_random_key,omitempty"` // 使用publickey_ver指定版本的公钥进行非对称加密后base64加密的内容,需要业务方先base64 decode处理后,再使用指定版本的私钥进行解密,得出内容。
EncryptChatMsg string `json:"encrypt_chat_msg,omitempty"` // 消息密文。需要业务方使用将encrypt_random_key解密得到的内容,与encrypt_chat_msg,传入sdk接口DecryptData,得到消息明文。
}
type ChatMessage ¶
type ChatMessage struct {
Id string // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。
From string // 消息发送方id。同一企业内容为userid,非相同企业为external_userid。消息如果是机器人发出,也为external_userid。
ToList []string // 消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid。
Action string // 消息动作,目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型。
Type string // 消息类型
// contains filtered or unexported fields
}
func (ChatMessage) GetAgreeMessage ¶
func (c ChatMessage) GetAgreeMessage() (msg AgreeMessage)
func (ChatMessage) GetCalendarMessage ¶
func (c ChatMessage) GetCalendarMessage() (msg CalendarMessage)
func (ChatMessage) GetCardMessage ¶
func (c ChatMessage) GetCardMessage() (msg CardMessage)
func (ChatMessage) GetChatRecordMessage ¶
func (c ChatMessage) GetChatRecordMessage() (msg ChatRecordMessage)
func (ChatMessage) GetCollectMessage ¶
func (c ChatMessage) GetCollectMessage() (msg CollectMessage)
func (ChatMessage) GetDocMessage ¶
func (c ChatMessage) GetDocMessage() (msg DocMessage)
func (ChatMessage) GetEmotionMessage ¶
func (c ChatMessage) GetEmotionMessage() (msg EmotionMessage)
func (ChatMessage) GetExternalRedPacketMessage ¶
func (c ChatMessage) GetExternalRedPacketMessage() (msg ExternalRedPacketMessage)
func (ChatMessage) GetFileMessage ¶
func (c ChatMessage) GetFileMessage() (msg FileMessage)
func (ChatMessage) GetImageMessage ¶
func (c ChatMessage) GetImageMessage() (msg ImageMessage)
func (ChatMessage) GetLinkMessage ¶
func (c ChatMessage) GetLinkMessage() (msg LinkMessage)
func (ChatMessage) GetLocationMessage ¶
func (c ChatMessage) GetLocationMessage() (msg LocationMessage)
func (ChatMessage) GetMarkdownMessage ¶
func (c ChatMessage) GetMarkdownMessage() (msg MarkdownMessage)
func (ChatMessage) GetMeetingMessage ¶
func (c ChatMessage) GetMeetingMessage() (msg MeetingMessage)
func (ChatMessage) GetMeetingVoiceCallMessage ¶
func (c ChatMessage) GetMeetingVoiceCallMessage() (msg MeetingVoiceCallMessage)
func (ChatMessage) GetMixedMessage ¶
func (c ChatMessage) GetMixedMessage() (msg MixedMessage)
func (ChatMessage) GetNewsMessage ¶
func (c ChatMessage) GetNewsMessage() (msg NewsMessage)
func (ChatMessage) GetOriginMessage ¶ added in v1.0.2
func (c ChatMessage) GetOriginMessage() (msg map[string]interface{})
Unmarshal the origin data into map[string]interface{}
func (ChatMessage) GetRawChatMessage ¶ added in v1.3.0
func (c ChatMessage) GetRawChatMessage() json.RawMessage
Just return the raw json data.
func (ChatMessage) GetRedpacketMessage ¶
func (c ChatMessage) GetRedpacketMessage() (msg RedPacketMessage)
func (ChatMessage) GetRevokeMessage ¶
func (c ChatMessage) GetRevokeMessage() (msg RevokeMessage)
func (ChatMessage) GetSphFeedMessage ¶ added in v1.0.13
func (c ChatMessage) GetSphFeedMessage() (msg SphFeedMessage)
func (ChatMessage) GetSwitchMessage ¶
func (c ChatMessage) GetSwitchMessage() (msg SwitchMessage)
func (ChatMessage) GetTextMessage ¶
func (c ChatMessage) GetTextMessage() (msg TextMessage)
func (ChatMessage) GetTodoMessage ¶
func (c ChatMessage) GetTodoMessage() (msg TodoMessage)
func (ChatMessage) GetVideoMessage ¶
func (c ChatMessage) GetVideoMessage() (msg VideoMessage)
func (ChatMessage) GetVoiceMessage ¶
func (c ChatMessage) GetVoiceMessage() (msg VoiceMessage)
func (ChatMessage) GetVoipDocShareMessage ¶
func (c ChatMessage) GetVoipDocShareMessage() (msg VoipDocShareMessage)
func (ChatMessage) GetVoiptextMessage ¶ added in v1.3.0
func (c ChatMessage) GetVoiptextMessage() (msg VoiptextMessage)
func (ChatMessage) GetVoteMessage ¶
func (c ChatMessage) GetVoteMessage() (msg VoteMessage)
func (ChatMessage) GetWeappMessage ¶
func (c ChatMessage) GetWeappMessage() (msg WeAppMessage)
type ChatRawData ¶ added in v1.3.0
func (ChatRawData) IsError ¶ added in v1.3.0
func (c ChatRawData) IsError() bool
type ChatRecord ¶
type ChatRecord struct {
Type string `json:"type,omitempty"` // 每条聊天记录的具体消息类型:ChatRecordText/ ChatRecordFile/ ChatRecordImage/ ChatRecordVideo/ ChatRecordLink/ ChatRecordLocation/ ChatRecordMixed ….
Content string `json:"content,omitempty"` // 消息内容。Json串,内容为对应类型的json
MsgTime int64 `json:"msgtime,omitempty"` // 消息时间,utc时间,ms单位。
FromChatroom bool `json:"from_chatroom,omitempty"` // 是否来自群会话。
}
ChatRecord 会话记录消息item
type ChatRecordMessage ¶
type ChatRecordMessage struct {
BaseMessage
ChatRecord struct {
Title string `json:"title,omitempty"` // 聊天记录标题
Item []ChatRecord `json:"item,omitempty"` // 消息记录内的消息内容,批量数据
} `json:"chatrecord,omitempty"`
}
ChatRecordMessage 会话记录消息 类型为:chatrecord
type Client ¶
type Client interface {
// GetChatData 拉取聊天记录
//
// @param [in] seq 从指定的seq开始拉取消息,注意的是返回的消息从seq+1开始返回,seq为之前接口返回的最大seq值。首次使用请使用seq:0
// @param [in] limit 一次拉取的消息条数,最大值1000条,超过1000条会返回错误
// @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
// @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123
// @param [in] timeout 超时时间,单位秒
//
// @return chatDatas 返回本次拉取消息的数据,slice结构体.内容包括errcode/errmsg,以及每条消息内容。示例如下:
// {"errcode":0,"errmsg":"ok","chatdata":[{"seq":196,"msgid":"CAQQ2fbb4QUY0On2rYSAgAMgip/yzgs=","publickey_ver":3,"encrypt_random_key":"ftJ+uz3n/z1DsxlkwxNgE+mL38H42/KCvN8T60gbbtPD+Rta1hKTuQPzUzO6Hzne97MgKs7FfdDxDck/v8cDT6gUVjA2tZ/M7euSD0L66opJ/IUeBtpAtvgVSD5qhlaQjvfKJc/zPMGNK2xCLFYqwmQBZXbNT7uA69Fflm512nZKW/piK2RKdYJhRyvQnA1ISxK097sp9WlEgDg250fM5tgwMjujdzr7ehK6gtVBUFldNSJS7ndtIf6aSBfaLktZgwHZ57ONewWq8GJe7WwQf1hwcDbCh7YMG8nsweEwhDfUz+u8rz9an+0lgrYMZFRHnmzjgmLwrR7B/32Qxqd79A==","encrypt_chat_msg":"898WSfGMnIeytTsea7Rc0WsOocs0bIAerF6de0v2cFwqo9uOxrW9wYe5rCjCHHH5bDrNvLxBE/xOoFfcwOTYX0HQxTJaH0ES9OHDZ61p8gcbfGdJKnq2UU4tAEgGb8H+Q9n8syRXIjaI3KuVCqGIi4QGHFmxWenPFfjF/vRuPd0EpzUNwmqfUxLBWLpGhv+dLnqiEOBW41Zdc0OO0St6E+JeIeHlRZAR+E13Isv9eS09xNbF0qQXWIyNUi+ucLr5VuZnPGXBrSfvwX8f0QebTwpy1tT2zvQiMM2MBugKH6NuMzzuvEsXeD+6+3VRqL"}]}
//
GetChatData(seq uint64, limit uint64, proxy string, passwd string, timeout int) ([]ChatData, error)
// DecryptData 解析密文.企业微信自有解密内容
//
// @param [in] encrypt_key, getchatdata返回的encrypt_random_key,使用企业自持对应版本秘钥RSA解密后的内容
// @param [in] encrypt_msg, getchatdata返回的encrypt_chat_msg
// @param [out] msg, 解密的消息明文
//
// @return 返回是否调用成功
// 0 - 成功
// !=0 - 失败
//
DecryptData(encryptRandomKey string, encryptMsg string, specificPrivateKey string) (msg ChatMessage, err error)
// GetMediaData 拉取媒体消息函数
//
// Return值=0表示该API调用成功
// @param [in] sdk NewSdk返回的sdk指针
// @param [in] sdkFileid 从GetChatData返回的聊天消息中,媒体消息包括的sdkfileid
// @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
// @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123
// @param [in] indexbuf 媒体消息分片拉取,需要填入每次拉取的索引信息。首次不需要填写,默认拉取512k,后续每次调用只需要将上次调用返回的outindexbuf填入即可。
// @param [in] timeout 超时时间,单位秒
// @param [out] media_data 返回本次拉取的媒体数据.MediaData结构体.内容包括data(数据内容)/outindexbuf(下次索引)/is_finish(拉取完成标记)
//
// @return 返回是否调用成功
// 0 - 成功
// !=0 - 失败
//
GetMediaData(indexBuf string, sdkFileId string, proxy string, passwd string, timeout int) (*MediaData, error)
// Free 释放 Client
// 释放 C 指针,避免内存泄漏
Free()
}
func NewClient ¶
NewClient 初始化函数 Return值=0表示该API调用成功
@param [in] sdk NewSdk返回的sdk指针 @param [in] corpId 调用企业的企业id,例如:wwd08c8exxxx5ab44d,可以在企业微信管理端--我的企业--企业信息查看 @param [in] secret 聊天内容存档的Secret,可以在企业微信管理端--管理工具--聊天内容存档查看 @param [in] privateKey 消息加密私钥,可以在企业微信管理端--管理工具--消息加密公钥查看对用公钥,私钥一般由自己保存
@return 返回是否初始化成功
0 - 成功 !=0 - 失败
type CollectDetail ¶ added in v1.3.0
type CollectDetail struct {
ID uint64 `json:"id,omitempty"` // 表项id
Ques string `json:"ques,omitempty"` // 表项名称
Type string `json:"type,omitempty"` // 表项类型,有Text(文本),Number(数字),Date(日期),Time(时间)
}
CollectDetail 填表内容详情
type CollectMessage ¶
type CollectMessage struct {
BaseMessage
Collect struct {
RoomName string `json:"room_name,omitempty"` // 填表消息所在的群名称。
Creator string `json:"creator,omitempty"` // 创建者在群中的名字。
CreateTime string `json:"create_time,omitempty"` // 创建的时间。
Title string `json:"title,omitempty"` // 表名。
Details []CollectDetail `json:"details,omitempty"` // 表内容。
} `json:"collect,omitempty"`
}
CollectMessage 填表消息 类型为:collect
type DemoFileData ¶
type DemoFileData struct {
FileName string `json:"filename,omitempty"` // 文档共享名称
DemoOperator string `json:"demooperator,omitempty"` // 文档共享操作用户的id
StartTime int64 `json:"starttime,omitempty"` // 文档共享开始时间
EndTime int64 `json:"endtime,omitempty"` // 文档共享结束时间
}
DemoFileData 音频存档消息/文档分享对象
type DocMessage ¶
type DocMessage struct {
BaseMessage
Doc struct {
Title string `json:"title,omitempty"` // 在线文档名称
LinkURL string `json:"link_url,omitempty"` // 在线文档链接
DocCreator string `json:"doc_creator,omitempty"` // 在线文档创建者。本企业成员创建为userid;外部企业成员创建为external_userid
} `json:"doc,omitempty"`
}
DocMessage 在线文档消息 类型为:docmsg
type EmotionMessage ¶
type EmotionMessage struct {
BaseMessage
Emotion struct {
Type uint32 `json:"type,omitempty"` // 表情类型,png或者gif.1表示gif 2表示png。
Width uint32 `json:"width,omitempty"` // 表情图片宽度。
Height uint32 `json:"height,omitempty"` // 表情图片高度。
ImageSize uint32 `json:"imagesize,omitempty"` // 资源的文件大小。
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
} `json:"emotion,omitempty"`
}
EmotionMessage 表情 类型为:emotion
type Error ¶
type ExternalRedPacketMessage ¶
type ExternalRedPacketMessage struct {
BaseMessage
RedPacket struct {
Type int32 `json:"type,omitempty"` // 红包消息类型。1 普通红包、2 拼手气群红包。Uint32类型
Wish string `json:"wish,omitempty"` // 红包祝福语。String类型
TotalCnt int32 `json:"totalcnt,omitempty"` // 红包总个数。Uint32类型
TotalAmount int32 `json:"totalamount,omitempty"` // 红包消息类型。1 普通红包、2 拼手气群红包。Uint32类型
} `json:"redpacket,omitempty"`
}
ExternalRedPacketMessage 互通红包消息 类型为:external_redpacket,出现在本企业与外部企业群聊发送的红包、或者本企业与微信单聊、群聊发送的红包消息场景下。
type FileMessage ¶
type FileMessage struct {
BaseMessage
File struct {
FileName string `json:"filename,omitempty"` // 文件名称。
FileExt string `json:"fileext,omitempty"` // 文件类型后缀。
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
FileSize uint32 `json:"filesize,omitempty"` // 文件大小。
Md5Sum string `json:"md5sum,omitempty"` // 资源的md5值,供进行校验。
} `json:"file,omitempty"`
}
FileMessage 文件 类型为:file
type ImageMessage ¶
type ImageMessage struct {
BaseMessage
Image struct {
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
FileSize uint32 `json:"filesize,omitempty"` // 图片资源的文件大小。
} `json:"image,omitempty"`
}
ImageMessage 图片 类型为:image
type LinkMessage ¶
type LinkMessage struct {
BaseMessage
Link struct {
Title string `json:"title,omitempty"` // 消息标题。
Description string `json:"description,omitempty"` // 消息描述。
LinkURL string `json:"link_url,omitempty"` // 链接url地址
ImageURL string `json:"image_url,omitempty"` // 链接图片url。
} `json:"link,omitempty"`
}
LinkMessage 链接 类型为:link
type LocationMessage ¶
type LocationMessage struct {
BaseMessage
Location struct {
Longitude float64 `json:"longitude,omitempty"` // 经度,单位double
Latitude float64 `json:"latitude,omitempty"` // 纬度,单位double
Address string `json:"address,omitempty"` // 地址信息
Title string `json:"title,omitempty"` // 位置信息的title。
Zoom uint32 `json:"zoom,omitempty"` // 缩放比例。
} `json:"location,omitempty"`
}
LocationMessage 位置 类型为:location
type MarkdownMessage ¶
type MarkdownMessage struct {
BaseMessage
Info struct {
Content string `json:"content,omitempty"` // markdown消息内容,目前为机器人发出的消息
} `json:"info,omitempty"`
}
MarkdownMessage MarkDown消息 类型为:markdown
type MeetingMessage ¶
type MeetingMessage struct {
BaseMessage
Meeting struct {
Topic string `json:"topic,omitempty"` // 会议主题
StartTime int64 `json:"starttime,omitempty"` // 会议开始时间。Utc时间
EndTime int64 `json:"endtime,omitempty"` // 会议结束时间。Utc时间
Address string `json:"address,omitempty"` // 会议地址
Remarks string `json:"remarks,omitempty"` // 会议备注
MeetingType uint32 `json:"meetingtype,omitempty"` // 会议消息类型。101发起会议邀请消息、102处理会议邀请消息
MeetingID uint64 `json:"meetingid,omitempty"` // 会议id。方便将发起、处理消息进行对照
Status uint32 `json:"status,omitempty"` // 会议邀请处理状态。1 参加会议、2 拒绝会议、3 待定、4 未被邀请、5 会议已取消、6 会议已过期、7 不在房间内。
} `json:"meeting,omitempty"`
}
MeetingMessage 会议邀请消息 类型为:meeting
type MeetingVoiceCall ¶
type MeetingVoiceCall struct {
EndTime int64 `json:"endtime,omitempty"` // 音频结束时间
SdkFileID string `json:"sdkfileid,omitempty"` // 音频媒体下载的id
DemoFileData []DemoFileData `json:"demofiledata,omitempty"` // 文档分享对象,Object类型
}
MeetingVoiceCall 音频存档消息/音频消息内容
type MeetingVoiceCallMessage ¶
type MeetingVoiceCallMessage struct {
BaseMessage
VoiceID string `json:"voiceid,omitempty"` // 音频id
MeetingVoiceCall MeetingVoiceCall `json:"meeting_voice_call,omitempty"` // 音频消息内容。包括结束时间、fileid,可能包括多个demofiledata、sharescreendata消息,demofiledata表示文档共享信息,sharescreendata表示屏幕共享信息。Object类型
}
MeetingVoiceCallMessage 音频存档消息 类型为:meeting_voice_call
type MixedMessage ¶
type MixedMessage struct {
BaseMessage
Mixed struct {
Item []MixedMsg `json:"item,omitempty"`
} `json:"mixed,omitempty"` // 消息内容。可包含图片、文字、表情等多种消息。Object类型
}
MixedMessage 混合消息 类型为:mixed
type MixedMsg ¶
type MixedMsg struct {
Type string `json:"type,omitempty"`
Content string `json:"content,omitempty"`
}
MixedMsg 混合消息详情
type News ¶
type News struct {
Title string `json:"title,omitempty"` // 图文消息标题
Description string `json:"description,omitempty"` // 图文消息描述
URL string `json:"url,omitempty"` // 图文消息点击跳转地址
PicURL string `json:"picurl,omitempty"` // 图文消息配图的url
}
News 图文消息详情
type NewsMessage ¶
type NewsMessage struct {
BaseMessage
Info struct {
Item []News `json:"item,omitempty"` // 图文消息数组
} `json:"info,omitempty"` // 图文消息的内容
}
NewsMessage 图文消息 类型为:news
type RedPacketMessage ¶ added in v1.3.0
type RedPacketMessage struct {
BaseMessage
RedPacket struct {
Type uint32 `json:"type,omitempty"` // 红包消息类型。1 普通红包、2 拼手气群红包、3 激励群红包。
Wish string `json:"wish,omitempty"` // 红包祝福语
TotalCnt uint32 `json:"totalcnt,omitempty"` // 红包总个数
TotalAmount uint32 `json:"totalamount,omitempty"` // 红包总金额。单位为分。
} `json:"redpacket,omitempty"`
}
RedPacketMessage 红包消息 类型为:redpacket
type RevokeMessage ¶
type RevokeMessage struct {
BaseMessage
Revoke struct {
PreMsgID string `json:"pre_msgid,omitempty"` // 标识撤回的原消息的msgid
} `json:"revoke,omitempty"`
}
RevokeMessage 撤回消息 类型为:revoke
type SdkClient ¶ added in v1.3.0
type SdkClient struct {
// contains filtered or unexported fields
}
func (*SdkClient) DecryptData ¶ added in v1.3.0
func (s *SdkClient) DecryptData(encryptRandomKey string, encryptMsg string, specificPrivateKey string) (msg ChatMessage, err error)
DecryptData * * @brief 解析密文.企业微信自有解密内容 * @param [in] encryptRandomKey, getchatdata返回的encrypt_random_key,使用企业自持对应版本秘钥RSA解密后的内容 * @param [in] encryptMsg, getchatdata返回的encrypt_chat_msg * @param [out] msg, 解密的消息明文 * @return 返回是否调用成功 * 0 - 成功 * !=0 - 失败
func (*SdkClient) GetChatData ¶ added in v1.3.0
func (s *SdkClient) GetChatData(seq uint64, limit uint64, proxy string, passwd string, timeout int) ([]ChatData, error)
GetChatData 拉取聊天记录
@param [in] seq 从指定的seq开始拉取消息,注意的是返回的消息从seq+1开始返回,seq为之前接口返回的最大seq值。首次使用请使用seq:0 @param [in] limit 一次拉取的消息条数,最大值1000条,超过1000条会返回错误 @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081 @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123 @param [in] timeout 超时时间,单位秒
@return chatData 返回本次拉取消息的数据,slice结构体.内容包括errcode/errmsg,以及每条消息内容。示例如下: {"errcode":0,"errmsg":"ok","chatdata":[{"seq":196,"msgid":"CAQQ2fbb4QUY0On2rYSAgAMgip/yzgs=","publickey_ver":3,"encrypt_random_key":"ftJ+uz3n/z1DsxlkwxNgE+mL38H42/KCvN8T60gbbtPD+Rta1hKTuQPzUzO6Hzne97MgKs7FfdDxDck/v8cDT6gUVjA2tZ/M7euSD0L66opJ/IUeBtpAtvgVSD5qhlaQjvfKJc/zPMGNK2xCLFYqwmQBZXbNT7uA69Fflm512nZKW/piK2RKdYJhRyvQnA1ISxK097sp9WlEgDg250fM5tgwMjujdzr7ehK6gtVBUFldNSJS7ndtIf6aSBfaLktZgwHZ57ONewWq8GJe7WwQf1hwcDbCh7YMG8nsweEwhDfUz+u8rz9an+0lgrYMZFRHnmzjgmLwrR7B/32Qxqd79A==","encrypt_chat_msg":"898WSfGMnIeytTsea7Rc0WsOocs0bIAerF6de0v2cFwqo9uOxrW9wYe5rCjCHHH5bDrNvLxBE/xOoFfcwOTYX0HQxTJaH0ES9OHDZ61p8gcbfGdJKnq2UU4tAEgGb8H+Q9n8syRXIjaI3KuVCqGIi4QGHFmxWenPFfjF/vRuPd0EpzUNwmqfUxLBWLpGhv+dLnqiEOBW41Zdc0OO0St6E+JeIeHlRZAR+E13Isv9eS09xNbF0qQXWIyNUi+ucLr5VuZnPGXBrSfvwX8f0QebTwpy1tT2zvQiMM2MBugKH6NuMzzuvEsXeD+6+3VRqL"}]}
func (*SdkClient) GetContentFromSlice ¶ added in v1.3.0
func (s *SdkClient) GetContentFromSlice(slice *C.struct_Slice_t) []byte
func (*SdkClient) GetMediaData ¶ added in v1.3.0
func (s *SdkClient) GetMediaData(indexBuf string, sdkFileId string, proxy string, passwd string, timeout int) (*MediaData, error)
GetMediaData *
拉取媒体消息函数
Return值=0表示该API调用成功 * *
@param [in] sdk NewSdk返回的sdk指针
@param [in] sdkFileId 从GetChatData返回的聊天消息中,媒体消息包括的sdkfileid
@param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081
@param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123
@param [in] indexbuf 媒体消息分片拉取,需要填入每次拉取的索引信息。首次不需要填写,默认拉取512k,后续每次调用只需要将上次调用返回的outindexbuf填入即可。
@param [in] timeout 超时时间,单位秒
@param [out] media_data 返回本次拉取的媒体数据.MediaData结构体.内容包括data(数据内容)/outindexbuf(下次索引)/is_finish(拉取完成标记)
*
@return 返回是否调用成功
0 - 成功
!=0 - 失败
type SphFeedMessage ¶ added in v1.0.13
type SphFeedMessage struct {
BaseMessage
SphFeed struct {
FeedType string `json:"feed_type,omitempty"` // 视频号消息类型
SphName string `json:"sph_name,omitempty"` // 视频号账号名称
FeedDesc string `json:"feed_desc,omitempty"` // 视频号消息描述
}
}
SphFeedMessage 视频号消息 类型为:sphfeed
type SwitchMessage ¶
type SwitchMessage struct {
MsgID string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重
Action string `json:"action,omitempty"` // 消息动作,切换企业为switch
Time int64 `json:"time,omitempty"` // 消息发送时间戳,utc时间,ms单位。
User string `json:"user,omitempty"` // 具体为切换企业的成员的userid。
}
SwitchMessage 切换企业日志 注:切换企业日志不是真正的消息,与上述消息结构不完全相同
type TextMessage ¶
type TextMessage struct {
BaseMessage
Text struct {
Content string `json:"content,omitempty"` // 消息内容。
} `json:"text,omitempty"`
}
TextMessage 文本 类型为:text
type TodoMessage ¶
type TodoMessage struct {
BaseMessage
Todo struct {
Title string `json:"title,omitempty"` // 代办的来源文本
Content string `json:"content,omitempty"` // 代办的具体内容
} `json:"todo,omitempty"`
}
TodoMessage 待办消息 类型为:todo
type VideoMessage ¶
type VideoMessage struct {
BaseMessage
Video struct {
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
FileSize uint32 `json:"filesize,omitempty"` // 图片资源的文件大小。
PlayLength uint32 `json:"play_length,omitempty"` // 播放长度。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
} `json:"video,omitempty"`
}
VideoMessage 视频 类型为:video
type VoiceMessage ¶
type VoiceMessage struct {
BaseMessage
Voice struct {
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
VoiceSize uint32 `json:"voice_size,omitempty"` // 语音消息大小。
PlayLength uint32 `json:"play_length,omitempty"` // 播放长度。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
} `json:"voice,omitempty"`
}
VoiceMessage 语音 类型为:voice
type VoipDocShareMessage ¶
type VoipDocShareMessage struct {
}
VoipDocShareMessage 音频共享文档消息 类型为:voip_doc_share
type VoiptextMessage ¶ added in v1.3.0
type VoiptextMessage struct {
BaseMessage
Voiptext struct {
Callduration uint32 `json:"callduration,omitempty"` // 通话时长,单位秒
Invitetype uint32 `json:"invitetype,omitempty"` // 通话类型,1:单人视频通话 2:单人语音通话 3:多人视频通话 4:多人语音通话
}
}
VoiptextMessage 音视频通话 类型为:voiptext
type VoteMessage ¶
type VoteMessage struct {
BaseMessage
VoteTitle string `json:"votetitle,omitempty"` // 投票主题。
VoteItem []string `json:"voteitem,omitempty"` // 投票选项,可能多个内容。
VoteType uint32 `json:"votetype,omitempty"` // 投票类型.101发起投票、102参与投票。
VoteID string `json:"voteid,omitempty"` // 投票id,方便将参与投票消息与发起投票消息进行前后对照。
}
VoteMessage 投票消息 类型为:vote
type WeAppMessage ¶ added in v1.3.0
type WeAppMessage struct {
BaseMessage
WeApp struct {
Title string `json:"title,omitempty"` // 消息标题。
Description string `json:"description,omitempty"` // 消息描述。
Username string `json:"username,omitempty"` // 用户名称。
DisplayName string `json:"displayname,omitempty"` // 小程序名称
} `json:"weapp,omitempty"`
}
WeAppMessage 小程序消息 类型为:weapp