@@ -2,148 +2,148 @@ import type { AppContext } from "../../mod.ts";
22import { HubSpotClient } from "../../utils/client.ts" ;
33
44export interface Attachment {
5- /**
6- * @title Attachment Type
7- * @description Type of attachment
8- */
9- type : "FILE" | "QUICK_REPLIES" | "SOCIAL_MEDIA_METADATA" ;
10-
11- /**
12- * @title File ID
13- * @description ID of the file (required for FILE type)
14- */
15- fileId ?: string ;
16-
17- /**
18- * @title Name
19- * @description Name of the attachment
20- */
21- name ?: string ;
22-
23- /**
24- * @title URL
25- * @description URL of the attachment
26- */
27- url ?: string ;
28-
29- /**
30- * @title File Usage Type
31- * @description Usage type for the file
32- */
33- fileUsageType ?: string ;
5+ /**
6+ * @title Attachment Type
7+ * @description Type of attachment
8+ */
9+ type : "FILE" | "QUICK_REPLIES" | "SOCIAL_MEDIA_METADATA" ;
10+
11+ /**
12+ * @title File ID
13+ * @description ID of the file (required for FILE type)
14+ */
15+ fileId ?: string ;
16+
17+ /**
18+ * @title Name
19+ * @description Name of the attachment
20+ */
21+ name ?: string ;
22+
23+ /**
24+ * @title URL
25+ * @description URL of the attachment
26+ */
27+ url ?: string ;
28+
29+ /**
30+ * @title File Usage Type
31+ * @description Usage type for the file
32+ */
33+ fileUsageType ?: string ;
3434}
3535
3636export interface Props {
37- /**
38- * @title Thread ID
39- * @description The ID of the conversation thread
40- */
41- threadId : string ;
42-
43- /**
44- * @title Comment Text
45- * @description The text content of the comment
46- */
47- text : string ;
48-
49- /**
50- * @title Rich Text
51- * @description Rich text content (HTML)
52- */
53- richText ?: string ;
54-
55- /**
56- * @title Attachments
57- * @description Array of attachments
58- */
59- attachments ?: Attachment [ ] ;
37+ /**
38+ * @title Thread ID
39+ * @description The ID of the conversation thread
40+ */
41+ threadId : string ;
42+
43+ /**
44+ * @title Comment Text
45+ * @description The text content of the comment
46+ */
47+ text : string ;
48+
49+ /**
50+ * @title Rich Text
51+ * @description Rich text content (HTML)
52+ */
53+ richText ?: string ;
54+
55+ /**
56+ * @title Attachments
57+ * @description Array of attachments
58+ */
59+ attachments ?: Attachment [ ] ;
6060}
6161
6262export interface Client {
63- clientType : "HUBSPOT" ;
64- integrationAppId : number ;
63+ clientType : "HUBSPOT" ;
64+ integrationAppId : number ;
6565}
6666
6767export interface Sender {
68- actorId : string ;
69- name ?: string ;
70- senderField ?: string ;
71- deliveryIdentifier ?: {
72- type : string ;
73- value : string ;
74- } ;
68+ actorId : string ;
69+ name ?: string ;
70+ senderField ?: string ;
71+ deliveryIdentifier ?: {
72+ type : string ;
73+ value : string ;
74+ } ;
7575}
7676
7777export interface MessageRecipient {
78- actorId : string ;
79- name ?: string ;
80- deliveryIdentifier ?: {
81- type : string ;
82- value : string ;
83- } ;
84- recipientField ?: string ;
78+ actorId : string ;
79+ name ?: string ;
80+ deliveryIdentifier ?: {
81+ type : string ;
82+ value : string ;
83+ } ;
84+ recipientField ?: string ;
8585}
8686
8787export interface FailureDetails {
88- errorMessageTokens : Record < string , unknown > ;
89- errorMessage ?: string ;
88+ errorMessageTokens : Record < string , unknown > ;
89+ errorMessage ?: string ;
9090}
9191
9292export interface MessageStatus {
93- statusType : "SENT" | "FAILED" | "PENDING" ;
94- failureDetails ?: FailureDetails ;
93+ statusType : "SENT" | "FAILED" | "PENDING" ;
94+ failureDetails ?: FailureDetails ;
9595}
9696
9797export interface CommentResponse {
98- type : "COMMENT" ;
99- id : string ;
100- conversationsThreadId : string ;
101- createdAt : string ;
102- updatedAt ?: string ;
103- createdBy : string ;
104- client : Client ;
105- senders : Sender [ ] ;
106- recipients : MessageRecipient [ ] ;
107- archived : boolean ;
108- text ?: string ;
109- richText ?: string ;
110- attachments : Attachment [ ] ;
111- subject ?: string ;
112- truncationStatus :
113- | "NOT_TRUNCATED"
114- | "TRUNCATED_TO_MOST_RECENT_REPLY"
115- | "TRUNCATED" ;
116- inReplyToId ?: string ;
117- status ?: MessageStatus ;
118- direction : "INCOMING" | "OUTGOING" ;
119- channelId : string ;
120- channelAccountId : string ;
98+ type : "COMMENT" ;
99+ id : string ;
100+ conversationsThreadId : string ;
101+ createdAt : string ;
102+ updatedAt ?: string ;
103+ createdBy : string ;
104+ client : Client ;
105+ senders : Sender [ ] ;
106+ recipients : MessageRecipient [ ] ;
107+ archived : boolean ;
108+ text ?: string ;
109+ richText ?: string ;
110+ attachments : Attachment [ ] ;
111+ subject ?: string ;
112+ truncationStatus :
113+ | "NOT_TRUNCATED"
114+ | "TRUNCATED_TO_MOST_RECENT_REPLY"
115+ | "TRUNCATED" ;
116+ inReplyToId ?: string ;
117+ status ?: MessageStatus ;
118+ direction : "INCOMING" | "OUTGOING" ;
119+ channelId : string ;
120+ channelAccountId : string ;
121121}
122122
123123/**
124124 * @title Send Thread Comment
125125 * @description Send a comment to a conversation thread
126126 */
127127export default async function sendThreadComment (
128- props : Props ,
129- _req : Request ,
130- ctx : AppContext ,
128+ props : Props ,
129+ _req : Request ,
130+ ctx : AppContext ,
131131) : Promise < CommentResponse > {
132- const { threadId, text, richText, attachments = [ ] } = props ;
132+ const { threadId, text, richText, attachments = [ ] } = props ;
133133
134- const client = new HubSpotClient ( ctx ) ;
134+ const client = new HubSpotClient ( ctx ) ;
135135
136- const commentData : Record < string , unknown > = {
137- type : "COMMENT" ,
138- text,
139- ...( richText && { richText } ) ,
140- ...( attachments . length > 0 && { attachments } ) ,
141- } ;
136+ const commentData : Record < string , unknown > = {
137+ type : "COMMENT" ,
138+ text,
139+ ...( richText && { richText } ) ,
140+ ...( attachments . length > 0 && { attachments } ) ,
141+ } ;
142142
143- const response = await client . post < CommentResponse > (
144- `/conversations/v3/conversations/threads/${ threadId } /messages` ,
145- commentData ,
146- ) ;
143+ const response = await client . post < CommentResponse > (
144+ `/conversations/v3/conversations/threads/${ threadId } /messages` ,
145+ commentData ,
146+ ) ;
147147
148- return response ;
148+ return response ;
149149}
0 commit comments