Documentation
¶
Index ¶
- type AccountID
- type Attachment
- type AttachmentID
- type ChatwootAPI
- func (api *ChatwootAPI) ContactIDForIdentifier(ctx context.Context, identifier string) (ContactID, error)
- func (api *ChatwootAPI) CreateContact(ctx context.Context, identifier string) (ContactID, error)
- func (api *ChatwootAPI) CreateConversation(ctx context.Context, sourceID string, contactID ContactID, ...) (*Conversation, error)
- func (api *ChatwootAPI) DeleteMessage(ctx context.Context, conversationID ConversationID, messageID MessageID) error
- func (api *ChatwootAPI) DoRequest(req *http.Request) (*http.Response, error)
- func (api *ChatwootAPI) DownloadAttachment(ctx context.Context, url string) ([]byte, error)
- func (api *ChatwootAPI) GetChatwootConversation(ctx context.Context, conversationID ConversationID) (*Conversation, error)
- func (api *ChatwootAPI) GetConversation(ctx context.Context, id ConversationID) (*Conversation, error)
- func (api *ChatwootAPI) GetConversationLabels(ctx context.Context, conversationID ConversationID) ([]string, error)
- func (api *ChatwootAPI) MakeURI(endpoint string) string
- func (api *ChatwootAPI) SendAttachmentMessage(ctx context.Context, conversationID ConversationID, filename string, ...) (*Message, error)
- func (api *ChatwootAPI) SendPrivateMessage(ctx context.Context, conversationID ConversationID, content string) (*Message, error)
- func (api *ChatwootAPI) SendTextMessage(ctx context.Context, conversationID ConversationID, content string, ...) (*Message, error)
- func (api *ChatwootAPI) SetConversationCustomAttributes(ctx context.Context, conversationID ConversationID, ...) error
- func (api *ChatwootAPI) SetConversationLabels(ctx context.Context, conversationID ConversationID, labels []string) error
- func (api *ChatwootAPI) ToggleStatus(ctx context.Context, conversationID ConversationID, status ConversationStatus) error
- type Contact
- type ContactID
- type ContactPayload
- type ContactPayloadInner
- type ContactsPayload
- type ContentAttributes
- type Conversation
- type ConversationID
- type ConversationLabelsPayload
- type ConversationMeta
- type ConversationStatus
- type ConversationsPayload
- type CreateContactPayload
- type InboxID
- type Message
- type MessageCreated
- type MessageID
- type MessageType
- type Sender
- type SenderID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type AttachmentID ¶
type AttachmentID int
type ChatwootAPI ¶
type ChatwootAPI struct {
BaseURL string
AccountID AccountID
InboxID InboxID
AccessToken string
Client *http.Client
}
func CreateChatwootAPI ¶
func CreateChatwootAPI(baseURL string, accountID AccountID, inboxID InboxID, accessToken string) *ChatwootAPI
func (*ChatwootAPI) ContactIDForIdentifier ¶
func (*ChatwootAPI) CreateContact ¶
func (*ChatwootAPI) CreateConversation ¶
func (api *ChatwootAPI) CreateConversation(ctx context.Context, sourceID string, contactID ContactID, additionalAttrs map[string]string) (*Conversation, error)
func (*ChatwootAPI) DeleteMessage ¶
func (api *ChatwootAPI) DeleteMessage(ctx context.Context, conversationID ConversationID, messageID MessageID) error
func (*ChatwootAPI) DownloadAttachment ¶
func (*ChatwootAPI) GetChatwootConversation ¶
func (api *ChatwootAPI) GetChatwootConversation(ctx context.Context, conversationID ConversationID) (*Conversation, error)
func (*ChatwootAPI) GetConversation ¶
func (api *ChatwootAPI) GetConversation(ctx context.Context, id ConversationID) (*Conversation, error)
func (*ChatwootAPI) GetConversationLabels ¶
func (api *ChatwootAPI) GetConversationLabels(ctx context.Context, conversationID ConversationID) ([]string, error)
func (*ChatwootAPI) MakeURI ¶
func (api *ChatwootAPI) MakeURI(endpoint string) string
func (*ChatwootAPI) SendAttachmentMessage ¶
func (api *ChatwootAPI) SendAttachmentMessage(ctx context.Context, conversationID ConversationID, filename string, mimeType string, fileData io.Reader, messageType MessageType) (*Message, error)
func (*ChatwootAPI) SendPrivateMessage ¶
func (api *ChatwootAPI) SendPrivateMessage(ctx context.Context, conversationID ConversationID, content string) (*Message, error)
func (*ChatwootAPI) SendTextMessage ¶
func (api *ChatwootAPI) SendTextMessage(ctx context.Context, conversationID ConversationID, content string, messageType MessageType) (*Message, error)
func (*ChatwootAPI) SetConversationCustomAttributes ¶
func (api *ChatwootAPI) SetConversationCustomAttributes(ctx context.Context, conversationID ConversationID, customAttrs map[string]string) error
func (*ChatwootAPI) SetConversationLabels ¶
func (api *ChatwootAPI) SetConversationLabels(ctx context.Context, conversationID ConversationID, labels []string) error
func (*ChatwootAPI) ToggleStatus ¶
func (api *ChatwootAPI) ToggleStatus(ctx context.Context, conversationID ConversationID, status ConversationStatus) error
type Contact ¶
type Contact struct {
ID ContactID `json:"id"`
Identifier string `json:"identifier"`
PhoneNumber string `json:"phone_number,omitempty"`
Email string `json:"email,omitempty"`
}
Contact
type ContactPayload ¶
type ContactPayload struct {
Payload ContactPayloadInner `json:"payload"`
}
type ContactPayloadInner ¶
type ContactPayloadInner struct {
Contact Contact `json:"contact"`
}
type ContactsPayload ¶
type ContactsPayload struct {
Payload []Contact `json:"payload"`
}
type ContentAttributes ¶
type ContentAttributes struct {
Deleted bool `json:"deleted"`
}
type Conversation ¶
type Conversation struct {
ID ConversationID `json:"id"`
AccountID AccountID `json:"account_id"`
InboxID InboxID `json:"inbox_id"`
Messages []Message `json:"messages"`
Meta ConversationMeta `json:"meta"`
CustomAttributes map[string]string `json:"custom_attributes"`
}
type ConversationID ¶
type ConversationID int
type ConversationLabelsPayload ¶
type ConversationLabelsPayload struct {
Payload []string `json:"payload"`
}
type ConversationMeta ¶
type ConversationMeta struct {
Sender Contact `json:"sender"`
}
type ConversationStatus ¶
type ConversationStatus string
const ( ConversationStatusOpen ConversationStatus = "open" ConversationStatusResolved ConversationStatus = "resolved" ConversationStatusPending ConversationStatus = "pending" )
type ConversationsPayload ¶
type ConversationsPayload struct {
Payload []Conversation `json:"payload"`
}
type CreateContactPayload ¶
type Message ¶
type Message struct {
ID MessageID `json:"id"`
Content *string `json:"content"`
Private bool `json:"private"`
Attachments []Attachment `json:"attachments"`
Sender Sender `json:"sender"`
}
type MessageCreated ¶
type MessageCreated struct {
ID MessageID `json:"id"`
Content string `json:"content"`
CreatedAt string `json:"created_at"`
MessageType string `json:"message_type"`
ContentType string `json:"content_type"`
ContentAttributes *ContentAttributes `json:"content_attributes"`
Private bool `json:"private"`
Conversation Conversation `json:"conversation"`
}
type MessageType ¶
type MessageType string
const ( IncomingMessage MessageType = "incoming" OutgoingMessage MessageType = "outgoing" )
Click to show internal directories.
Click to hide internal directories.