chatwootclient

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 6 Imported by: 1

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 added in v0.1.1

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)

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 added in v0.1.1

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

type ContactInbox added in v0.1.1

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

type CreateContactRequest added in v0.1.1

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 added in v0.1.1

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 added in v0.1.1

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

Jump to

Keyboard shortcuts

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