import { AxiosPromise } from 'axios'; import { Message, GetConversationMessagesOptions, FilterMessagesOptions } from './interfaces/Message'; import { Conversation, ConversationStatus } from './interfaces/Conversation'; import { ReplyPart } from './interfaces/ReplyPart'; import { User } from './interfaces/User'; import { Agent } from './interfaces/Agent'; import { ReportType } from './interfaces/Report'; import { MessagePart } from './interfaces/MessagePart'; export * from './interfaces/Conversation'; export * from './interfaces/Message'; export * from './interfaces/DashboardHistorical'; export * from './interfaces/User'; export * from './interfaces/Report'; export default class Freshchat { private apiUrl; private apiToken; private ruleAlias?; private get headers(); constructor(apiUrl: string, apiToken: string, ruleAlias?: string | undefined); /** * Calls Freshchat Dashboard Historical API to fetch average wait time. */ getAverageWaitTimeGivenGroupId(groupId: string, durationInHours: number): Promise; /** * Calls Freshchat Dashboard Historical API to fetch unassigned count. */ getUnassignedCountGivenGroupId(groupId: string, unassignedDuration: number): Promise; /** * Calls Freshchat Conversation API to assign a conversation to agent/group. */ conversationAssign(conversationId: string, resourceId: string, assignTo: 'agent' | 'group', status: ConversationStatus): AxiosPromise; /** * Calls Freshchat conversation API to create message. */ postMessage(conversationId: string, message: string, messageType: 'normal' | 'private', actorType?: 'agent' | 'bot', actorId?: string, replyParts?: ReplyPart[], isEmailConversation?: boolean): AxiosPromise; sendReply(conversationId: string, messageType: 'normal' | 'private', actorType: 'agent' | 'bot', messageParts: MessagePart[], replyParts?: ReplyPart[], actorId?: string): AxiosPromise; private _getConversationMessagesByUrl; /** * Calls Freshchat conversation api to fetch all messages in a particular conversation. */ getConversationMessages(conversationId: string, options?: GetConversationMessagesOptions): Promise; /** * Calls Freshchat conversation API to create message. */ /** * Calls Freshchat Conversation API to resolve/reopen a conversation. */ conversationStatusUpdate(conversationId: string, status: 'assigned' | 'new' | 'resolved' | 'waiting on customer' | 'waiting on internal team'): AxiosPromise; /** * Send a quickreply message */ sendQuickreply(conversationId: string, message: string, responses: string[]): AxiosPromise; /** * Send Normal Reply. */ sendNormalReplyText(conversationId: string, message: string, agentId?: string, isEmailConversation?: boolean): AxiosPromise; /** Update User API */ updateUser(userId: string, properties: { email?: string; first_name?: string; last_name?: string; phone?: string; properties?: { name: string; value: string; }[]; }): AxiosPromise<''>; getUserById(userId: string): Promise; getSystemUserById(userId: string): Promise; getAgentById(agentId: string): Promise; getAgentsById(agentIds: string[]): Promise; getSystemUsersById(userIds: string[]): Promise; getConversationTranscript(baseUrl: string, accountId: string, conversationId: string, options?: GetConversationMessagesOptions, filterMessagesOptions?: FilterMessagesOptions): Promise; triggerRawReports(startTime: string, endTime: string, eventType: ReportType, isExcludePii: boolean): Promise<{ id: string; link: { href: string; rel: string; }; }>; retrieveRawReports(requestId: string): Promise<{ id: string; interval: string; links: { from: string; link: { href: string; rel: string; }; status: string; to: string; }[]; status: 'COMPLETED' | string; }>; /** * Calls Freshchat Conversation API to update Conversation Properties. */ conversationPropertiesUpdate(conversationId: string, status: string, properties: unknown, assigned_agent_id: string): AxiosPromise; /** * Calls Freshchat Conversation API to get Conversation Properties Fields. */ getConversationPropertyFields(): Promise<{ data?: any; error?: any; }>; }