chatwootclient

package
v0.0.0-...-3b4c77d Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 6 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
	AccountId     int
	AgentBotToken string
	AgentToken    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, accountId int, agentBotToken string) ChatwootClient

func NewChatwootClientWithAgentToken

func NewChatwootClientWithAgentToken(baseUrl string, accountId int, agentBotToken string, agentToken string) ChatwootClient

func (*ChatwootClient) AddLabel

func (client *ChatwootClient) AddLabel(conversationId int, label string) error

func (*ChatwootClient) AddLabels

func (client *ChatwootClient) AddLabels(conversationId int, labels []string) error

func (*ChatwootClient) Assign

func (client *ChatwootClient) Assign(conversationId int, assignee_id int) error

func (*ChatwootClient) AssignTeam

func (client *ChatwootClient) AssignTeam(conversationId int, team_id int) error

func (*ChatwootClient) CreateContact

func (client *ChatwootClient) CreateContact(createContactRequest CreateContactRequest) (CreateContactResponse, error)

func (*ChatwootClient) CreateIncomingMessage

func (client *ChatwootClient) CreateIncomingMessage(conversationId int, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateIncomingPrivateMessage

func (client *ChatwootClient) CreateIncomingPrivateMessage(conversationId int, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateNewConversation

func (client *ChatwootClient) CreateNewConversation(createNewConversationRequest CreateNewConversationRequest) (CreateNewConversationResponse, error)

func (*ChatwootClient) CreateNewMessage

func (client *ChatwootClient) CreateNewMessage(conversationId int, createMessageRequest CreateNewMessageRequest) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateOutgoingMessage

func (client *ChatwootClient) CreateOutgoingMessage(conversationId int, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) CreateOutgoingPrivateMessage

func (client *ChatwootClient) CreateOutgoingPrivateMessage(conversationId int, content string) (CreateNewMessageResponse, error)

func (*ChatwootClient) GetMessages

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

func (*ChatwootClient) SearchContact

func (client *ChatwootClient) SearchContact(query string) (SearchContactResponse, error)

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"`
	Email          string         `json:"email"`
	ContactInboxes []ContactInbox `json:"contact_inboxes"`
}

type ContactInbox

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

type CreateContactPayload

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

type CreateContactRequest

type CreateContactRequest struct {
	InboxID          int         `json:"inbox_id,omitempty"`
	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 CreateContactPayload `json:"payload"`
}

type CreateNewConversationRequest

type CreateNewConversationRequest struct {
	SourceID  string `json:"source_id,omitempty"`
	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 SearchContactResponse

type SearchContactResponse struct {
	Payload []Contact `json:"payload"`
}

Jump to

Keyboard shortcuts

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