kf

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account 客服账号管理

func NewAccount

func NewAccount(account contracts.AccountInterface) *Account

func (*Account) Add

func (a *Account) Add(name, mediaId string) (string, error)

Add 添加客服账号

func (*Account) AddContactWay

func (a *Account) AddContactWay(openKfid, scene string) (string, error)

AddContactWay 获取客服账号链接

func (*Account) Delete

func (a *Account) Delete(openKfid string) error

Delete 删除客服账号

func (*Account) List

func (a *Account) List(offset, limit int) (*AccountListResult, error)

List 获取客服账号列表

func (*Account) Update

func (a *Account) Update(req UpdateAccountRequest) error

Update 修改客服账号

type AccountInfo

type AccountInfo struct {
	OpenKfid        string `json:"open_kfid"`
	Name            string `json:"name"`
	Avatar          string `json:"avatar"`
	ManagePrivilege bool   `json:"manage_privilege"`
}

AccountInfo 客服账号信息

type AccountListResult

type AccountListResult struct {
	AccountList []AccountInfo `json:"account_list"`
}

AccountListResult 获取客服账号列表结果

type Kf

type Kf struct {
	// contains filtered or unexported fields
}

Kf 微信客服

func NewKf

func NewKf(account contracts.AccountInterface) *Kf

func (*Kf) Account

func (k *Kf) Account() *Account

Account 客服账号管理

func (*Kf) Message

func (k *Kf) Message() *Message

Message 客服消息

func (*Kf) ServiceState

func (k *Kf) ServiceState() *ServiceState

ServiceState 会话管理

func (*Kf) Servicer

func (k *Kf) Servicer() *Servicer

Servicer 接待人员管理

type MediaContent

type MediaContent struct {
	MediaId string `json:"media_id"`
}

MediaContent 媒体消息内容(图片/语音/视频)

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message 客服消息

func NewMessage

func NewMessage(account contracts.AccountInterface) *Message

func (*Message) SendImage

func (m *Message) SendImage(toUser, openKfid, mediaId string, msgid ...string) (string, error)

SendImage 发送图片消息

func (*Message) SendText

func (m *Message) SendText(toUser, openKfid, content string, msgid ...string) (string, error)

SendText 发送文本消息

func (*Message) SendVideo

func (m *Message) SendVideo(toUser, openKfid, mediaId string, msgid ...string) (string, error)

SendVideo 发送视频消息

func (*Message) SendVoice

func (m *Message) SendVoice(toUser, openKfid, mediaId string, msgid ...string) (string, error)

SendVoice 发送语音消息

func (*Message) SyncMsg

func (m *Message) SyncMsg(req SyncMsgRequest) (*SyncMsgResult, error)

SyncMsg 读取消息

type MsgEventContent

type MsgEventContent struct {
	EventType      string `json:"event_type"`
	OpenKfid       string `json:"open_kfid"`
	ExternalUserid string `json:"external_userid"`
	Scene          string `json:"scene,omitempty"`
	SceneParam     string `json:"scene_param,omitempty"`
	WelcomeCode    string `json:"welcome_code,omitempty"`
	WechatChannels *struct {
		Nickname string `json:"nickname,omitempty"`
	} `json:"wechat_channels,omitempty"`
}

MsgEventContent 事件消息内容

type ServiceState

type ServiceState struct {
	// contains filtered or unexported fields
}

ServiceState 会话管理

func NewServiceState

func NewServiceState(account contracts.AccountInterface) *ServiceState

func (*ServiceState) Get

func (s *ServiceState) Get(openKfid, externalUserid string) (*ServiceStateInfo, error)

Get 获取会话状态

func (*ServiceState) Trans

Trans 变更会话状态

type ServiceStateInfo

type ServiceStateInfo struct {
	ServiceState   int    `json:"service_state"`
	ServicerUserid string `json:"servicer_userid"`
}

ServiceStateInfo 会话状态信息

type ServiceStateTransRequest

type ServiceStateTransRequest struct {
	OpenKfid       string `json:"open_kfid"`
	ExternalUserid string `json:"external_userid"`
	ServiceState   int    `json:"service_state"`
	ServicerUserid string `json:"servicer_userid,omitempty"`
}

ServiceStateTransRequest 变更会话状态请求

type Servicer

type Servicer struct {
	// contains filtered or unexported fields
}

Servicer 接待人员管理

func NewServicer

func NewServicer(account contracts.AccountInterface) *Servicer

func (*Servicer) Add

func (s *Servicer) Add(openKfid string, useridList []string) ([]ServicerResult, error)

Add 添加接待人员

func (*Servicer) Delete

func (s *Servicer) Delete(openKfid string, useridList []string) ([]ServicerResult, error)

Delete 删除接待人员

func (*Servicer) List

func (s *Servicer) List(openKfid string) ([]ServicerInfo, error)

List 获取接待人员列表

type ServicerInfo

type ServicerInfo struct {
	Userid       string `json:"userid"`
	Status       int    `json:"status"`
	StopType     int    `json:"stop_type,omitempty"`
	DepartmentId int    `json:"department_id,omitempty"`
}

ServicerInfo 接待人员信息

type ServicerResult

type ServicerResult struct {
	Userid  string `json:"userid"`
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

ServicerResult 添加/删除接待人员结果项

type SyncMsgItem

type SyncMsgItem struct {
	MsgId          string           `json:"msgid"`
	OpenKfid       string           `json:"open_kfid"`
	ExternalUserid string           `json:"external_userid"`
	SendTime       int64            `json:"send_time"`
	Origin         int              `json:"origin"`
	ServicerUserid string           `json:"servicer_userid"`
	MsgType        string           `json:"msgtype"`
	Text           *TextContent     `json:"text,omitempty"`
	Image          *MediaContent    `json:"image,omitempty"`
	Voice          *MediaContent    `json:"voice,omitempty"`
	Video          *MediaContent    `json:"video,omitempty"`
	Event          *MsgEventContent `json:"event,omitempty"`
}

SyncMsgItem 消息项

type SyncMsgRequest

type SyncMsgRequest struct {
	Cursor      string `json:"cursor,omitempty"`
	Token       string `json:"token,omitempty"`
	Limit       int    `json:"limit,omitempty"`
	VoiceFormat int    `json:"voice_format,omitempty"`
	OpenKfid    string `json:"open_kfid,omitempty"`
}

SyncMsgRequest 读取消息请求

type SyncMsgResult

type SyncMsgResult struct {
	NextCursor string        `json:"next_cursor"`
	HasMore    int           `json:"has_more"`
	MsgList    []SyncMsgItem `json:"msg_list"`
}

SyncMsgResult 读取消息结果

type TextContent

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

TextContent 文本消息内容

type UpdateAccountRequest

type UpdateAccountRequest struct {
	OpenKfid string `json:"open_kfid"`
	Name     string `json:"name,omitempty"`
	MediaId  string `json:"media_id,omitempty"`
}

UpdateAccountRequest 修改客服账号请求

Jump to

Keyboard shortcuts

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