Documentation
¶
Index ¶
- type AccountLabel
- type AccountLabelsListResponse
- type AccountLabelsService
- type AddLabelsRequest
- type Agent
- type AgentFull
- type AgentsService
- type AssignRequest
- type Attachment
- type Client
- func (c *Client) AccountLabels() *AccountLabelsService
- func (c *Client) Agents() *AgentsService
- func (c *Client) Contacts() *ContactsService
- func (c *Client) Conversations() *ConversationsService
- func (c *Client) Delete(path string, v interface{}) error
- func (c *Client) Get(path string, params url.Values, v interface{}) error
- func (c *Client) GetRaw(path string, params url.Values, v interface{}) error
- func (c *Client) Inboxes() *InboxesService
- func (c *Client) Labels(conversationID int) *LabelsService
- func (c *Client) Messages(conversationID int) *MessagesService
- func (c *Client) Patch(path string, body io.Reader, v interface{}) error
- func (c *Client) Post(path string, body io.Reader, v interface{}) error
- func (c *Client) Profile() *ProfileService
- func (c *Client) Teams() *TeamsService
- type ClientOption
- type Contact
- type ContactConversationsResponse
- type ContactFull
- type ContactsListOptions
- type ContactsListResponse
- type ContactsSearchOptions
- type ContactsService
- func (s *ContactsService) Conversations(id int) (*ContactConversationsResponse, error)
- func (s *ContactsService) Get(id int) (*ContactFull, error)
- func (s *ContactsService) List(opts ContactsListOptions) (*ContactsListResponse, error)
- func (s *ContactsService) Search(opts ContactsSearchOptions) (*ContactsListResponse, error)
- type Conversation
- type ConversationMeta
- type ConversationsListResponse
- type ConversationsService
- func (s *ConversationsService) Assign(id int, assigneeID *int, teamID int) (*User, error)
- func (s *ConversationsService) Get(id int) (*Conversation, error)
- func (s *ConversationsService) List(opts ListOptions) (*ConversationsListResponse, error)
- func (s *ConversationsService) ToggleStatus(id int, status string, snoozedUntil *int64) (*ToggleStatusResponse, error)
- func (s *ConversationsService) Unassign(id int) error
- func (s *ConversationsService) UpdatePriority(id int, priority string) error
- type CreateMessageRequest
- type Inbox
- type InboxFull
- type InboxesListResponse
- type InboxesService
- type LabelsResponse
- type LabelsService
- type ListOptions
- type Message
- type MessageConversation
- type MessageSender
- type MessagesListResponse
- type MessagesService
- func (s *MessagesService) Create(content string, private bool) (*Message, error)
- func (s *MessagesService) CreateWithRequest(body CreateMessageRequest) (*Message, error)
- func (s *MessagesService) Delete(messageID int) error
- func (s *MessagesService) List(beforeID int, afterID ...int) (*MessagesListResponse, error)
- type ProfileResponse
- type ProfileService
- type Team
- type TeamFull
- type TeamsService
- type ToggleStatusRequest
- type ToggleStatusResponse
- type UpdatePriorityRequest
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountLabel ¶
type AccountLabelsListResponse ¶
type AccountLabelsListResponse struct {
Payload []AccountLabel `json:"payload"`
}
type AccountLabelsService ¶
type AccountLabelsService struct {
// contains filtered or unexported fields
}
func (*AccountLabelsService) List ¶
func (s *AccountLabelsService) List() ([]AccountLabel, error)
List returns all labels defined on the account.
type AddLabelsRequest ¶
type AddLabelsRequest struct {
Labels []string `json:"labels"`
}
type AgentsService ¶
type AgentsService struct {
// contains filtered or unexported fields
}
func (*AgentsService) List ¶
func (s *AgentsService) List() ([]AgentFull, error)
List returns all agents. The API returns a raw array, not wrapped in payload.
type AssignRequest ¶
type Attachment ¶
type Client ¶
type Client struct {
BaseURL string
APIKey string
AccountID int
Verbose bool
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(baseURL, apiKey string, accountID int, opts ...ClientOption) *Client
func (*Client) AccountLabels ¶
func (c *Client) AccountLabels() *AccountLabelsService
AccountLabels returns the account-level labels service.
func (*Client) Contacts ¶
func (c *Client) Contacts() *ContactsService
Contacts returns the contacts service
func (*Client) Conversations ¶
func (c *Client) Conversations() *ConversationsService
Conversations returns the conversations service
func (*Client) GetRaw ¶
GetRaw makes a GET request to a non-account-scoped path (e.g. /api/v1/profile).
func (*Client) Inboxes ¶
func (c *Client) Inboxes() *InboxesService
Inboxes returns the inboxes service
func (*Client) Labels ¶
func (c *Client) Labels(conversationID int) *LabelsService
Labels returns the labels service for a conversation
func (*Client) Messages ¶
func (c *Client) Messages(conversationID int) *MessagesService
Messages returns the messages service for a conversation
func (*Client) Profile ¶
func (c *Client) Profile() *ProfileService
Profile returns the profile service
type ClientOption ¶
type ClientOption func(*Client)
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
func WithVerbose ¶
func WithVerbose(verbose bool) ClientOption
type ContactConversationsResponse ¶
type ContactConversationsResponse struct {
Payload []Conversation `json:"payload"`
}
type ContactFull ¶
type ContactFull struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
PhoneNumber string `json:"phone_number"`
Thumbnail string `json:"thumbnail"`
Identifier string `json:"identifier"`
CompanyName string `json:"company_name,omitempty"`
LastActivityAt int64 `json:"last_activity_at"`
CreatedAt int64 `json:"created_at"`
ConversationsCount int `json:"conversations_count,omitempty"`
CustomAttributes map[string]interface{} `json:"custom_attributes"`
AdditionalAttributes map[string]interface{} `json:"additional_attributes"`
}
type ContactsListOptions ¶
type ContactsListResponse ¶
type ContactsListResponse struct {
Meta map[string]interface{} `json:"meta"`
Payload []ContactFull `json:"payload"`
}
type ContactsSearchOptions ¶
type ContactsService ¶
type ContactsService struct {
// contains filtered or unexported fields
}
func (*ContactsService) Conversations ¶
func (s *ContactsService) Conversations(id int) (*ContactConversationsResponse, error)
Conversations returns the conversations associated with a contact.
func (*ContactsService) Get ¶
func (s *ContactsService) Get(id int) (*ContactFull, error)
func (*ContactsService) List ¶
func (s *ContactsService) List(opts ContactsListOptions) (*ContactsListResponse, error)
func (*ContactsService) Search ¶
func (s *ContactsService) Search(opts ContactsSearchOptions) (*ContactsListResponse, error)
type Conversation ¶
type Conversation struct {
ID int `json:"id"`
AccountID int `json:"account_id"`
InboxID int `json:"inbox_id"`
Status string `json:"status"`
Priority *string `json:"priority"`
MessagesCount int `json:"messages_count"`
UnreadCount int `json:"unread_count,omitempty"`
CreatedAt int64 `json:"created_at"`
Timestamp int64 `json:"timestamp"`
LastActivityAt int64 `json:"last_activity_at"`
ContactLastSeenAt int64 `json:"contact_last_seen_at"`
AgentLastSeenAt int64 `json:"agent_last_seen_at"`
Meta ConversationMeta `json:"meta"`
Labels []string `json:"labels"`
AdditionalAttributes map[string]interface{} `json:"additional_attributes"`
Messages []Message `json:"messages"`
}
type ConversationMeta ¶
type ConversationsListResponse ¶
type ConversationsListResponse struct {
Data struct {
Meta struct {
AllCount int `json:"all_count"`
AssignedCount int `json:"assigned_count"`
UnassignedCount int `json:"unassigned_count"`
MineCount int `json:"mine_count"`
} `json:"meta"`
Payload []Conversation `json:"payload"`
} `json:"data"`
}
type ConversationsService ¶
type ConversationsService struct {
// contains filtered or unexported fields
}
func (*ConversationsService) Assign ¶
Assign updates the conversation's assignee and/or team. Pass a nil assigneeID to leave the agent assignment untouched (e.g. team-only assignment). Pass a pointer to 0 to explicitly unassign the agent.
func (*ConversationsService) Get ¶
func (s *ConversationsService) Get(id int) (*Conversation, error)
func (*ConversationsService) List ¶
func (s *ConversationsService) List(opts ListOptions) (*ConversationsListResponse, error)
func (*ConversationsService) ToggleStatus ¶
func (s *ConversationsService) ToggleStatus(id int, status string, snoozedUntil *int64) (*ToggleStatusResponse, error)
func (*ConversationsService) Unassign ¶
func (s *ConversationsService) Unassign(id int) error
func (*ConversationsService) UpdatePriority ¶
func (s *ConversationsService) UpdatePriority(id int, priority string) error
UpdatePriority sets the conversation priority. Accepted values: "urgent", "high", "medium", "low". Pass "" to clear (sends JSON null).
Note: Chatwoot's swagger spec also lists "none" as a valid enum value, but the live toggle_priority endpoint returns 500 when sent literally. Sending null clears the priority cleanly.
type CreateMessageRequest ¶
type CreateMessageRequest struct {
Content string `json:"content"`
MessageType string `json:"message_type,omitempty"`
Private bool `json:"private,omitempty"`
ContentType string `json:"content_type,omitempty"`
ContentAttributes map[string]interface{} `json:"content_attributes,omitempty"`
CampaignID int `json:"campaign_id,omitempty"`
TemplateParams map[string]interface{} `json:"template_params,omitempty"`
}
type InboxesListResponse ¶
type InboxesListResponse struct {
Payload []InboxFull `json:"payload"`
}
type InboxesService ¶
type InboxesService struct {
// contains filtered or unexported fields
}
func (*InboxesService) List ¶
func (s *InboxesService) List() (*InboxesListResponse, error)
type LabelsResponse ¶
type LabelsResponse struct {
Payload []string `json:"payload"`
}
type LabelsService ¶
type LabelsService struct {
// contains filtered or unexported fields
}
func (*LabelsService) List ¶
func (s *LabelsService) List() ([]string, error)
type ListOptions ¶
type Message ¶
type Message struct {
ID int `json:"id"`
Content string `json:"content"`
AccountID int `json:"account_id"`
InboxID int `json:"inbox_id"`
ConversationID int `json:"conversation_id"`
ContentType string `json:"content_type"`
ContentAttributes map[string]interface{} `json:"content_attributes"`
MessageType int `json:"message_type"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt interface{} `json:"updated_at"`
Private bool `json:"private"`
SourceID *string `json:"source_id"`
SenderType *string `json:"sender_type"`
SenderID *int `json:"sender_id"`
AdditionalAttributes map[string]interface{} `json:"additional_attributes"`
Sender *MessageSender `json:"sender"`
Attachments []Attachment `json:"attachments"`
Conversation *MessageConversation `json:"conversation"`
}
type MessageConversation ¶
type MessageSender ¶
type MessagesListResponse ¶
type MessagesService ¶
type MessagesService struct {
// contains filtered or unexported fields
}
func (*MessagesService) Create ¶
func (s *MessagesService) Create(content string, private bool) (*Message, error)
func (*MessagesService) CreateWithRequest ¶
func (s *MessagesService) CreateWithRequest(body CreateMessageRequest) (*Message, error)
func (*MessagesService) Delete ¶
func (s *MessagesService) Delete(messageID int) error
func (*MessagesService) List ¶
func (s *MessagesService) List(beforeID int, afterID ...int) (*MessagesListResponse, error)
type ProfileResponse ¶
type ProfileResponse struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
AvailabilityStatus string `json:"availability_status"`
Role string `json:"role"`
Thumbnail string `json:"thumbnail"`
AvatarURL string `json:"avatar_url"`
AccountID int `json:"account_id"`
UISettings map[string]interface{} `json:"ui_settings"`
}
type ProfileService ¶
type ProfileService struct {
// contains filtered or unexported fields
}
func (*ProfileService) Get ¶
func (s *ProfileService) Get() (*ProfileResponse, error)
Get fetches the current user's profile. Uses a non-account-scoped endpoint.
type TeamsService ¶
type TeamsService struct {
// contains filtered or unexported fields
}
func (*TeamsService) List ¶
func (s *TeamsService) List() ([]TeamFull, error)
List returns all teams. The API returns a raw array, not wrapped in payload.
type ToggleStatusRequest ¶
type ToggleStatusResponse ¶
type UpdatePriorityRequest ¶
type UpdatePriorityRequest struct {
Priority *string `json:"priority"`
}
type User ¶
type User struct {
ID int `json:"id"`
AccessToken string `json:"access_token"`
AccountID int `json:"account_id"`
AvailableName string `json:"available_name"`
AvatarURL string `json:"avatar_url"`
Confirmed bool `json:"confirmed"`
DisplayName *string `json:"display_name"`
MessageSignature *string `json:"message_signature"`
Email string `json:"email"`
HMACIdentifier string `json:"hmac_identifier"`
InviterID *int `json:"inviter_id"`
Name string `json:"name"`
Provider string `json:"provider"`
PubsubToken string `json:"pubsub_token"`
Role string `json:"role"`
UISettings map[string]interface{} `json:"ui_settings"`
UID string `json:"uid"`
Type *string `json:"type"`
CustomAttributes map[string]interface{} `json:"custom_attributes"`
AvailabilityStatus string `json:"availability_status"`
}