@squidcloud/freshdesk-client 1.0.430

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,212 @@
1
+ import { IntegrationId } from '../../../../internal-common/src/public-types/communication.public-types';
2
+ /**
3
+ * Freshdesk API Types - Shared between backend and client
4
+ */
5
+ export type FreshdeskPriority = 1 | 2 | 3 | 4;
6
+ export declare const PRIORITY_LABELS: Record<FreshdeskPriority, string>;
7
+ export type FreshdeskStatus = 2 | 3 | 4 | 5;
8
+ export declare const STATUS_LABELS: Record<FreshdeskStatus, string>;
9
+ export type FreshdeskSource = 1 | 2 | 3 | 7 | 8 | 9 | 10;
10
+ export declare const SOURCE_LABELS: Record<FreshdeskSource, string>;
11
+ export interface FreshdeskContact {
12
+ id: number;
13
+ name: string;
14
+ email: string;
15
+ phone?: string;
16
+ mobile?: string;
17
+ company_id?: number;
18
+ active: boolean;
19
+ job_title?: string;
20
+ language?: string;
21
+ time_zone?: string;
22
+ created_at: string;
23
+ updated_at: string;
24
+ }
25
+ export interface FreshdeskCompany {
26
+ id: number;
27
+ name: string;
28
+ description?: string;
29
+ domains?: Array<string>;
30
+ created_at: string;
31
+ updated_at: string;
32
+ }
33
+ export interface FreshdeskAgent {
34
+ id: number;
35
+ contact: {
36
+ name: string;
37
+ email: string;
38
+ phone?: string;
39
+ mobile?: string;
40
+ job_title?: string;
41
+ active: boolean;
42
+ };
43
+ available: boolean;
44
+ occasional: boolean;
45
+ ticket_scope: number;
46
+ group_ids: Array<number>;
47
+ role_ids: Array<number>;
48
+ created_at: string;
49
+ updated_at: string;
50
+ }
51
+ export interface FreshdeskGroup {
52
+ id: number;
53
+ name: string;
54
+ description?: string;
55
+ agent_ids: Array<number>;
56
+ auto_ticket_assign: boolean;
57
+ escalate_to?: number;
58
+ created_at: string;
59
+ updated_at: string;
60
+ }
61
+ export interface FreshdeskAttachment {
62
+ id: number;
63
+ name: string;
64
+ content_type: string;
65
+ size: number;
66
+ created_at: string;
67
+ updated_at: string;
68
+ attachment_url: string;
69
+ }
70
+ export interface FreshdeskConversation {
71
+ id: number;
72
+ body: string;
73
+ body_text: string;
74
+ incoming: boolean;
75
+ private: boolean;
76
+ user_id: number;
77
+ support_email?: string;
78
+ source: number;
79
+ ticket_id: number;
80
+ to_emails?: Array<string>;
81
+ from_email?: string;
82
+ cc_emails?: Array<string>;
83
+ bcc_emails?: Array<string>;
84
+ attachments?: Array<FreshdeskAttachment>;
85
+ created_at: string;
86
+ updated_at: string;
87
+ }
88
+ export interface FreshdeskTicket {
89
+ id: number;
90
+ subject: string;
91
+ description: string;
92
+ description_text: string;
93
+ status: FreshdeskStatus;
94
+ priority: FreshdeskPriority;
95
+ source: FreshdeskSource;
96
+ requester_id: number;
97
+ responder_id?: number;
98
+ company_id?: number;
99
+ group_id?: number;
100
+ type?: string;
101
+ tags?: Array<string>;
102
+ due_by?: string;
103
+ fr_due_by?: string;
104
+ is_escalated: boolean;
105
+ spam: boolean;
106
+ email_config_id?: number;
107
+ product_id?: number;
108
+ custom_fields?: Record<string, unknown>;
109
+ created_at: string;
110
+ updated_at: string;
111
+ }
112
+ export interface FreshdeskTicketDetails {
113
+ detailsAsString: string;
114
+ ticket: FreshdeskTicket;
115
+ conversations: Array<FreshdeskConversation>;
116
+ }
117
+ export type RelatedTicketsMode = 'RESOLVED_OR_CLOSED' | 'ALL' | 'NONE';
118
+ export declare const RELATED_TICKETS_MODE_ENUM: Array<string>;
119
+ /** Request to search Freshdesk tickets by text */
120
+ export interface SearchFreshdeskTicketsRequest {
121
+ /** The ID of the Freshdesk integration */
122
+ integrationId: IntegrationId;
123
+ /** The search query to find tickets */
124
+ query: string;
125
+ /** Maximum number of tickets to return (default: 50) */
126
+ limit?: number;
127
+ }
128
+ /** Request to get details of a Freshdesk ticket */
129
+ export interface GetFreshdeskTicketRequest {
130
+ /** The ID of the Freshdesk integration */
131
+ integrationId: IntegrationId;
132
+ /** The Freshdesk ticket ID */
133
+ ticketId: number;
134
+ /** Whether to include related tickets in the response */
135
+ relatedTicketsMode?: RelatedTicketsMode;
136
+ }
137
+ /** Request to create a Freshdesk ticket */
138
+ export interface CreateFreshdeskTicketRequest {
139
+ /** The ID of the Freshdesk integration */
140
+ integrationId: IntegrationId;
141
+ /** The subject/title of the ticket */
142
+ subject: string;
143
+ /** The description of the ticket */
144
+ description: string;
145
+ /** Email of the requester */
146
+ email: string;
147
+ /** Priority (1=Low, 2=Medium, 3=High, 4=Urgent) */
148
+ priority?: FreshdeskPriority;
149
+ /** Status (2=Open, 3=Pending, 4=Resolved, 5=Closed) */
150
+ status?: FreshdeskStatus;
151
+ /** Tags to apply to the ticket */
152
+ tags?: Array<string>;
153
+ /** Ticket type */
154
+ type?: string;
155
+ }
156
+ /** Request to update a Freshdesk ticket */
157
+ export interface UpdateFreshdeskTicketRequest {
158
+ /** The ID of the Freshdesk integration */
159
+ integrationId: IntegrationId;
160
+ /** The Freshdesk ticket ID */
161
+ ticketId: number;
162
+ /** New subject for the ticket */
163
+ subject?: string;
164
+ /** New description for the ticket */
165
+ description?: string;
166
+ /** New priority */
167
+ priority?: FreshdeskPriority;
168
+ /** New status */
169
+ status?: FreshdeskStatus;
170
+ /** Tags to set on the ticket */
171
+ tags?: Array<string>;
172
+ /** Ticket type */
173
+ type?: string;
174
+ }
175
+ /** Request to reply to a Freshdesk ticket */
176
+ export interface ReplyToFreshdeskTicketRequest {
177
+ /** The ID of the Freshdesk integration */
178
+ integrationId: IntegrationId;
179
+ /** The Freshdesk ticket ID */
180
+ ticketId: number;
181
+ /** The reply text (HTML supported) */
182
+ body: string;
183
+ /** Whether this is a private note (default: false) */
184
+ private?: boolean;
185
+ }
186
+ /** Request to add a note to a Freshdesk ticket */
187
+ export interface AddFreshdeskNoteRequest {
188
+ /** The ID of the Freshdesk integration */
189
+ integrationId: IntegrationId;
190
+ /** The Freshdesk ticket ID */
191
+ ticketId: number;
192
+ /** The note text */
193
+ body: string;
194
+ /** Whether this is a private note (default: true) */
195
+ private?: boolean;
196
+ }
197
+ /** Response from Freshdesk ticket operations */
198
+ export interface FreshdeskTicketResponse {
199
+ /** Ticket ID */
200
+ id: number;
201
+ /** Ticket subject */
202
+ subject: string;
203
+ /** Ticket URL */
204
+ url: string;
205
+ }
206
+ /** Response with ticket details as string */
207
+ export interface FreshdeskTicketDetailsResponse {
208
+ /** Ticket ID */
209
+ id: number;
210
+ /** Ticket details as formatted string */
211
+ details: string;
212
+ }
@@ -0,0 +1,110 @@
1
+ import { IntegrationId, Squid } from '@squidcloud/client';
2
+ import { FreshdeskPriority, FreshdeskStatus, FreshdeskTicketResponse, RelatedTicketsMode } from '../../common/src/freshdesk-types';
3
+ /**
4
+ * Client for interacting with the Freshdesk connector.
5
+ * Provides methods for searching, creating, updating, and managing Freshdesk tickets.
6
+ */
7
+ export declare class FreshdeskClient {
8
+ private readonly squid;
9
+ private readonly integrationId;
10
+ /**
11
+ * Creates a new FreshdeskClient instance.
12
+ * @param squid - The Squid client instance
13
+ * @param integrationId - The ID of the Freshdesk integration to use
14
+ */
15
+ constructor(squid: Squid, integrationId: IntegrationId);
16
+ /**
17
+ * Searches for Freshdesk tickets matching a text query.
18
+ * @param query - The search query to find tickets
19
+ * @param limit - Maximum number of tickets to return (default: 50)
20
+ * @returns Ticket search results as a formatted string
21
+ */
22
+ searchTickets(query: string, limit?: number): Promise<string>;
23
+ /**
24
+ * Gets detailed information about a specific Freshdesk ticket.
25
+ * @param ticketId - The Freshdesk ticket ID
26
+ * @param relatedTicketsMode - Whether to include related tickets (default: 'RESOLVED_OR_CLOSED')
27
+ * @returns Ticket details as a formatted string
28
+ */
29
+ getTicketDetails(ticketId: number, relatedTicketsMode?: RelatedTicketsMode): Promise<string>;
30
+ /**
31
+ * Creates a new Freshdesk ticket.
32
+ * @param subject - The subject/title of the ticket
33
+ * @param description - The description of the ticket
34
+ * @param email - Email of the requester
35
+ * @param options - Additional options (priority, status, tags, type)
36
+ * @returns The created ticket information
37
+ */
38
+ createTicket(subject: string, description: string, email: string, options?: {
39
+ priority?: FreshdeskPriority;
40
+ status?: FreshdeskStatus;
41
+ tags?: Array<string>;
42
+ type?: string;
43
+ }): Promise<FreshdeskTicketResponse>;
44
+ /**
45
+ * Updates an existing Freshdesk ticket.
46
+ * @param ticketId - The Freshdesk ticket ID
47
+ * @param updates - The fields to update
48
+ * @returns The updated ticket information
49
+ */
50
+ updateTicket(ticketId: number, updates: {
51
+ subject?: string;
52
+ description?: string;
53
+ priority?: FreshdeskPriority;
54
+ status?: FreshdeskStatus;
55
+ tags?: Array<string>;
56
+ type?: string;
57
+ }): Promise<FreshdeskTicketResponse>;
58
+ /**
59
+ * Replies to a Freshdesk ticket.
60
+ * @param ticketId - The Freshdesk ticket ID
61
+ * @param body - The reply text (HTML supported)
62
+ * @param isPrivate - Whether this is a private note (default: false)
63
+ * @returns The conversation ID of the reply
64
+ */
65
+ replyToTicket(ticketId: number, body: string, isPrivate?: boolean): Promise<{
66
+ conversationId: number;
67
+ }>;
68
+ /**
69
+ * Adds a private note to a Freshdesk ticket.
70
+ * @param ticketId - The Freshdesk ticket ID
71
+ * @param body - The note text
72
+ * @param isPrivate - Whether this is a private note (default: true)
73
+ * @returns The conversation ID of the note
74
+ */
75
+ addNote(ticketId: number, body: string, isPrivate?: boolean): Promise<{
76
+ conversationId: number;
77
+ }>;
78
+ /**
79
+ * Changes the status of a Freshdesk ticket.
80
+ * @param ticketId - The Freshdesk ticket ID
81
+ * @param status - The new status (2=Open, 3=Pending, 4=Resolved, 5=Closed)
82
+ * @returns The updated ticket information
83
+ */
84
+ changeStatus(ticketId: number, status: FreshdeskStatus): Promise<FreshdeskTicketResponse>;
85
+ /**
86
+ * Changes the priority of a Freshdesk ticket.
87
+ * @param ticketId - The Freshdesk ticket ID
88
+ * @param priority - The new priority (1=Low, 2=Medium, 3=High, 4=Urgent)
89
+ * @returns The updated ticket information
90
+ */
91
+ changePriority(ticketId: number, priority: FreshdeskPriority): Promise<FreshdeskTicketResponse>;
92
+ /**
93
+ * Resolves a Freshdesk ticket by setting its status to Resolved (4).
94
+ * @param ticketId - The Freshdesk ticket ID
95
+ * @returns The updated ticket information
96
+ */
97
+ resolveTicket(ticketId: number): Promise<FreshdeskTicketResponse>;
98
+ /**
99
+ * Closes a Freshdesk ticket by setting its status to Closed (5).
100
+ * @param ticketId - The Freshdesk ticket ID
101
+ * @returns The updated ticket information
102
+ */
103
+ closeTicket(ticketId: number): Promise<FreshdeskTicketResponse>;
104
+ /**
105
+ * Reopens a Freshdesk ticket by setting its status to Open (2).
106
+ * @param ticketId - The Freshdesk ticket ID
107
+ * @returns The updated ticket information
108
+ */
109
+ reopenTicket(ticketId: number): Promise<FreshdeskTicketResponse>;
110
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../../common/src/freshdesk-types';
2
+ export * from './freshdesk-client';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{FreshdeskClient:()=>c,PRIORITY_LABELS:()=>i,RELATED_TICKETS_MODE_ENUM:()=>s,SOURCE_LABELS:()=>r,STATUS_LABELS:()=>n});const i={1:"Low",2:"Medium",3:"High",4:"Urgent"},n={2:"Open",3:"Pending",4:"Resolved",5:"Closed"},r={1:"Email",2:"Portal",3:"Phone",7:"Chat",8:"Mobihelp",9:"Feedback Widget",10:"Outbound Email"},s=["RESOLVED_OR_CLOSED","ALL","NONE"];class c{constructor(e,t){this.squid=e,this.integrationId=t}async searchTickets(e,t=50){const i={integrationId:this.integrationId,query:e,limit:t};return this.squid.executeFunction("searchFreshdeskTicketsExecutable",i)}async getTicketDetails(e,t="RESOLVED_OR_CLOSED"){const i={integrationId:this.integrationId,ticketId:e,relatedTicketsMode:t};return this.squid.executeFunction("getFreshdeskTicketDetailsExecutable",i)}async createTicket(e,t,i,n){const r={integrationId:this.integrationId,subject:e,description:t,email:i,...n};return this.squid.executeFunction("createFreshdeskTicketExecutable",r)}async updateTicket(e,t){const i={integrationId:this.integrationId,ticketId:e,...t};return this.squid.executeFunction("updateFreshdeskTicketExecutable",i)}async replyToTicket(e,t,i=!1){const n={integrationId:this.integrationId,ticketId:e,body:t,private:i};return this.squid.executeFunction("replyToFreshdeskTicketExecutable",n)}async addNote(e,t,i=!0){const n={integrationId:this.integrationId,ticketId:e,body:t,private:i};return this.squid.executeFunction("addFreshdeskNoteExecutable",n)}async changeStatus(e,t){return this.updateTicket(e,{status:t})}async changePriority(e,t){return this.updateTicket(e,{priority:t})}async resolveTicket(e){return this.changeStatus(e,4)}async closeTicket(e){return this.changeStatus(e,5)}async reopenTicket(e){return this.changeStatus(e,2)}}var a=exports;for(var o in t)a[o]=t[o];t.__esModule&&Object.defineProperty(a,"__esModule",{value:!0})})();
@@ -0,0 +1,30 @@
1
+ /** A type alias for an application id. */
2
+ export type AppId = string;
3
+ /** A tuple of environment identifiers like 'dev' or 'prod'. */
4
+ export declare const ENVIRONMENT_IDS: readonly ["dev", "prod"];
5
+ /** A type representing valid environment identifiers derived from ENVIRONMENT_IDS. */
6
+ export type EnvironmentId = (typeof ENVIRONMENT_IDS)[number];
7
+ /** A type alias for a squid developer identifier. */
8
+ export type SquidDeveloperId = string;
9
+ /** A type alias for an integration id. */
10
+ export type IntegrationId = string;
11
+ /** A type alias for a client identifier. */
12
+ export type ClientId = string;
13
+ /** A type alias for a squid document identifier. */
14
+ export type SquidDocId = string;
15
+ /** A type alias for a client request identifier. */
16
+ export type ClientRequestId = string;
17
+ /** ID of AI agent. Also known as AI profile id. */
18
+ export type AiAgentId = string;
19
+ /** App-level ID of AI Knowledge Base */
20
+ export type AiKnowledgeBaseId = string;
21
+ /**
22
+ * The built-in agent id. Cannot be customized.
23
+ * @category AI
24
+ */
25
+ export declare const BUILT_IN_AGENT_ID = "built_in_agent";
26
+ /**
27
+ * A type alias for an AI context identifier.
28
+ * @category AI
29
+ */
30
+ export type AiContextId = string;
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@squidcloud/freshdesk-client",
3
+ "version": "1.0.430",
4
+ "description": "Squid Freshdesk Client - SDK for interacting with the Freshdesk connector",
5
+ "main": "dist/index.js",
6
+ "types": "dist/freshdesk-client/src/index.d.ts",
7
+ "scripts": {
8
+ "prebuild": "del-cli dist",
9
+ "build": "webpack --mode=production",
10
+ "lint": "eslint",
11
+ "publish:public": "npm run build && npm publish --access public"
12
+ },
13
+ "files": [
14
+ "dist/**/*"
15
+ ],
16
+ "keywords": [
17
+ "squid",
18
+ "freshdesk",
19
+ "support-tickets",
20
+ "connector"
21
+ ],
22
+ "author": "",
23
+ "license": "ISC",
24
+ "dependencies": {
25
+ "assertic": "^1.3.0",
26
+ "@squidcloud/client": "^1.0.430"
27
+ },
28
+ "engines": {
29
+ "node": ">=20.0.0"
30
+ }
31
+ }