chatwootclient

package
v0.0.0-...-8a51564 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddLabelsRequest

type AddLabelsRequest struct {
	Labels []string `json:"labels"`
}

type ChatwootClient

type ChatwootClient struct {
	BaseUrl string
}

Please note that certain functions like to add labels or assign agents are blocked when using an Agent Bot Token therefore an AgentToken has to be provided. The client uses the AgentBotToken wherever possible.

func NewChatwootClient

func NewChatwootClient(baseUrl string) ChatwootClient

func NewChatwootClientWithAgentToken

func NewChatwootClientWithAgentToken(baseUrl string) ChatwootClient

func (*ChatwootClient) AddLabel

func (client *ChatwootClient) AddLabel(accountId int64, conversationId int64, agentToken string, label string) error

func (*ChatwootClient) AddLabels

func (client *ChatwootClient) AddLabels(accountId int64, conversationId int64, agentToken string, labels []string) error

func (*ChatwootClient) Assign

func (client *ChatwootClient) Assign(accountId int64, conversationId int64, agentToken string, assignee_id int) error

func (*ChatwootClient) AssignTeam

func (client *ChatwootClient) AssignTeam(accountId int64, conversationId int64, agentToken string, team_id int) error

func (*ChatwootClient) CreateContact

func (client *ChatwootClient) CreateContact(accountId int64, agentToken string, createContactRequest CreateContactRequest) (CreateContactResponse, error)

func (*ChatwootClient) CreateIncomingMessage

func (client *ChatwootClient) CreateIncomingMessage(accountId int64, conversationId int64, agentBotToken string, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateIncomingPrivateMessage

func (client *ChatwootClient) CreateIncomingPrivateMessage(accountId int64, conversationId int64, agentBotToken string, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateNewConversation

func (client *ChatwootClient) CreateNewConversation(accountId int64, agentBotToken string, createNewConversationRequest CreateNewConversationRequest) (CreateNewConversationResponse, error)

func (*ChatwootClient) CreateNewMessage

func (client *ChatwootClient) CreateNewMessage(accountId int64, conversationId int64, agentBotToken string, createMessageRequest CreateNewMessageRequest) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateOutgoingMessage

func (client *ChatwootClient) CreateOutgoingMessage(accountId int64, conversationId int64, agentBotToken string, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateOutgoingPrivateMessage

func (client *ChatwootClient) CreateOutgoingPrivateMessage(accountId int64, conversationId int64, agentBotToken string, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) GetMessages

func (client *ChatwootClient) GetMessages(accountId int64, conversationId int64, agentToken string) (ChatwootMessages, error)

func (*ChatwootClient) ReadConversationMessage

func (client *ChatwootClient) ReadConversationMessage(accountId int64, conversationId int64, agentToken string, isBroadRead bool) error

*

  • 修改会话的ai状态

func (*ChatwootClient) SendConversationTips

func (client *ChatwootClient) SendConversationTips(accountId int64, conversationId int64, agentToken string, gptStatus string) error

*

  • 发送通知

func (*ChatwootClient) SendImageMessage

func (client *ChatwootClient) SendImageMessage(
	accountId int64,
	conversationId int64,
	agentBotToken string,
	imageUrl string,
	content string,
) (CreateNewMessageResponse, error)

func (*ChatwootClient) SendNotification

func (client *ChatwootClient) SendNotification(accountId int64, agentToken string, args SendNotificationRequest) error

*

  • 发送通知

func (*ChatwootClient) UpdateConversationAIDisabled

func (client *ChatwootClient) UpdateConversationAIDisabled(accountId int64, conversationId int64, agentToken string, aiDisabled bool) error

*

  • 修改会话的ai状态

type ChatwootMessages

type ChatwootMessages []struct {
	Id          int         `json:"id"`
	Content     string      `json:"content"`
	ContentType string      `json:"content_type,omitempty"`
	Private     bool        `json:"private,omitempty"`
	Sender      interface{} `json:"sender,omitempty"`
}

type Contact

type Contact struct {
	ID             int            `json:"id"`
	ContactInboxes []ContactInbox `json:"contact_inboxes"`
}

type ContactInbox

type ContactInbox struct {
	SourceID string `json:"source_id"`
}

type CreateContactRequest

type CreateContactRequest struct {
	InboxID          int         `json:"inbox_id"`
	Name             string      `json:"name,omitempty"`
	EMail            string      `json:"email,omitempty"`
	PhoneNumber      string      `json:"phone_number,omitempty"`
	Avatar           string      `json:"avatar,omitempty"`
	AvatarUrl        string      `json:"avatar_url,omitempty"`
	Identifier       string      `json:"identifier,omitempty"`
	CustomAttributes interface{} `json:"custom_attributes,omitempty"`
}

type CreateContactResponse

type CreateContactResponse struct {
	Payload Payload `json:"payload"`
}

type CreateNewConversationRequest

type CreateNewConversationRequest struct {
	SourceID  string `json:"source_id"`
	InboxID   int    `json:"inbox_id"`
	ContactID string `json:"contact_id,omitempty"`
	Status    string `json:"status,omitempty"`
}

type CreateNewConversationResponse

type CreateNewConversationResponse struct {
	ID        int `json:"id"`
	AccountId int `json:"account_id"`
	InboxId   int `json:"inbox_id"`
}

type CreateNewMessageRequest

type CreateNewMessageRequest struct {
	Content     string `json:"content"`
	MessageType string `json:"message_type"`
	Private     bool   `json:"private"`
}

Struct that allows to build minimal create message requests.

func NewCreateNewMessageRequest

func NewCreateNewMessageRequest(content string, messageType string, private bool) CreateNewMessageRequest

type CreateNewMessageResponse

type CreateNewMessageResponse struct {
	ID          int    `json:"id"`
	Content     string `json:"content"`
	MessageType int    `json:"message_type"` // Chatwoot 2.17.1 returns integers as message type in contrast to the API documentation
	Private     bool   `json:"private"`
}

type GetMessagesResponse

type GetMessagesResponse struct {
	Meta    interface{}      `json:"meta"`
	Payload ChatwootMessages `json:"payload"`
}

type Payload

type Payload struct {
	Contact Contact `json:"contact"`
}

type ReadConversationMessageRequest

type ReadConversationMessageRequest struct {
	IsBroadRead bool `json:"isBroadRead"`
}

type SendConversationTipsRequest

type SendConversationTipsRequest struct {
	GptStatus string `json:"gpt_status"`
}

type SendNotificationRequest

type SendNotificationRequest struct {
	UserId           int64  `json:"user_id"`
	NotificationType string `json:"notification_type"`
	PrimaryActorType string `json:"primary_actor_type"`
	PrimaryActorId   int64  `json:"primary_actor_id"`
}

type UpdateConversationAIDisabledRequest

type UpdateConversationAIDisabledRequest struct {
	AIDisabled bool `json:"ai_disabled"`
}

Jump to

Keyboard shortcuts

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