Skip to content

Commit 9967a62

Browse files
committed
fix(helpscout): mark nullable trigger output fields
1 parent b02a9f1 commit 9967a62

1 file changed

Lines changed: 58 additions & 36 deletions

File tree

‎apps/sim/triggers/helpscout/utils.ts‎

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -78,57 +78,75 @@ export function helpScoutSetupInstructions(eventLabel: string): string {
7878

7979
const PERSON_OUTPUT = {
8080
type: 'json',
81+
nullable: true,
8182
description: 'Person object (id, type, first, last, email)',
8283
} as const
8384

8485
const CONVERSATION_OUTPUTS: Record<string, TriggerOutput> = {
85-
id: { type: 'number', description: 'Conversation ID' },
86-
number: { type: 'number', description: 'Conversation number shown in Help Scout' },
87-
threadCount: { type: 'number', description: 'Number of published threads, excluding notes' },
88-
type: { type: 'string', description: 'email, chat, or phone' },
89-
folderId: { type: 'number', description: 'Folder ID' },
90-
status: { type: 'string', description: 'active, pending, closed, or spam' },
91-
state: { type: 'string', description: 'published, draft, or deleted' },
92-
subject: { type: 'string', description: 'Subject' },
93-
preview: { type: 'string', description: 'Preview text from the most recent thread' },
94-
mailboxId: { type: 'number', description: 'Inbox ID' },
86+
id: { type: 'number', description: 'Conversation ID', nullable: true },
87+
number: {
88+
type: 'number',
89+
description: 'Conversation number shown in Help Scout',
90+
nullable: true,
91+
},
92+
threadCount: {
93+
type: 'number',
94+
description: 'Number of published threads, excluding notes',
95+
nullable: true,
96+
},
97+
type: { type: 'string', description: 'email, chat, or phone', nullable: true },
98+
folderId: { type: 'number', description: 'Folder ID', nullable: true },
99+
status: { type: 'string', description: 'active, pending, closed, or spam', nullable: true },
100+
state: { type: 'string', description: 'published, draft, or deleted', nullable: true },
101+
subject: { type: 'string', description: 'Subject', nullable: true },
102+
preview: {
103+
type: 'string',
104+
description: 'Preview text from the most recent thread',
105+
nullable: true,
106+
},
107+
mailboxId: { type: 'number', description: 'Inbox ID', nullable: true },
95108
assignee: { ...PERSON_OUTPUT, description: 'User or team the conversation is assigned to' },
96109
createdBy: { ...PERSON_OUTPUT, description: 'User or customer who created the conversation' },
97110
primaryCustomer: { ...PERSON_OUTPUT, description: 'Primary customer of the conversation' },
98-
createdAt: { type: 'string', description: 'When the conversation was created' },
99-
closedAt: { type: 'string', description: 'When the conversation was closed' },
100-
closedBy: { type: 'number', description: 'ID of the user who closed it' },
101-
userUpdatedAt: { type: 'string', description: 'When a user last updated the conversation' },
111+
createdAt: { type: 'string', description: 'When the conversation was created', nullable: true },
112+
closedAt: { type: 'string', description: 'When the conversation was closed', nullable: true },
113+
closedBy: { type: 'number', description: 'ID of the user who closed it', nullable: true },
114+
userUpdatedAt: {
115+
type: 'string',
116+
description: 'When a user last updated the conversation',
117+
nullable: true,
118+
},
102119
customerWaitingSince: {
103120
type: 'string',
104121
description: 'When the customer started waiting for a reply',
122+
nullable: true,
105123
},
106-
sourceType: { type: 'string', description: 'Originating channel' },
107-
sourceVia: { type: 'string', description: 'user or customer' },
124+
sourceType: { type: 'string', description: 'Originating channel', nullable: true },
125+
sourceVia: { type: 'string', description: 'user or customer', nullable: true },
108126
tags: { type: 'array', description: 'Tags on the conversation (id, tag, color)' },
109127
cc: { type: 'array', description: 'CC email addresses' },
110128
bcc: { type: 'array', description: 'BCC email addresses' },
111129
customFields: { type: 'array', description: 'Custom field values (id, name, value, text)' },
112-
webUrl: { type: 'string', description: 'Link to the conversation in Help Scout' },
130+
webUrl: { type: 'string', description: 'Link to the conversation in Help Scout', nullable: true },
113131
}
114132

115133
const CUSTOMER_OUTPUTS: Record<string, TriggerOutput> = {
116-
id: { type: 'number', description: 'Customer ID' },
117-
firstName: { type: 'string', description: 'First name' },
118-
lastName: { type: 'string', description: 'Last name' },
119-
gender: { type: 'string', description: 'Gender' },
120-
jobTitle: { type: 'string', description: 'Job title' },
121-
location: { type: 'string', description: 'Location' },
122-
organization: { type: 'string', description: 'Organization name' },
123-
organizationId: { type: 'number', description: 'Organization ID' },
124-
photoType: { type: 'string', description: 'Photo source' },
125-
photoUrl: { type: 'string', description: 'Photo URL' },
126-
age: { type: 'string', description: 'Age' },
127-
background: { type: 'string', description: 'Notes about the customer' },
128-
conversationCount: { type: 'number', description: 'Number of conversations' },
129-
draft: { type: 'boolean', description: 'Whether the customer is a draft record' },
130-
createdAt: { type: 'string', description: 'When the customer was created' },
131-
updatedAt: { type: 'string', description: 'When the customer was updated' },
134+
id: { type: 'number', description: 'Customer ID', nullable: true },
135+
firstName: { type: 'string', description: 'First name', nullable: true },
136+
lastName: { type: 'string', description: 'Last name', nullable: true },
137+
gender: { type: 'string', description: 'Gender', nullable: true },
138+
jobTitle: { type: 'string', description: 'Job title', nullable: true },
139+
location: { type: 'string', description: 'Location', nullable: true },
140+
organization: { type: 'string', description: 'Organization name', nullable: true },
141+
organizationId: { type: 'number', description: 'Organization ID', nullable: true },
142+
photoType: { type: 'string', description: 'Photo source', nullable: true },
143+
photoUrl: { type: 'string', description: 'Photo URL', nullable: true },
144+
age: { type: 'string', description: 'Age', nullable: true },
145+
background: { type: 'string', description: 'Notes about the customer', nullable: true },
146+
conversationCount: { type: 'number', description: 'Number of conversations', nullable: true },
147+
draft: { type: 'boolean', description: 'Whether the customer is a draft record', nullable: true },
148+
createdAt: { type: 'string', description: 'When the customer was created', nullable: true },
149+
updatedAt: { type: 'string', description: 'When the customer was updated', nullable: true },
132150
emails: { type: 'array', description: 'Email addresses (id, value, type)' },
133151
phones: { type: 'array', description: 'Phone numbers (id, value, type)' },
134152
websites: { type: 'array', description: 'Websites (id, value, type)' },
@@ -145,7 +163,7 @@ const EVENT_TYPE_OUTPUT: TriggerOutput = {
145163
export function buildConversationEventOutputs(): Record<string, TriggerOutput> {
146164
return {
147165
eventType: EVENT_TYPE_OUTPUT,
148-
conversationId: { type: 'number', description: 'Conversation ID' },
166+
conversationId: { type: 'number', description: 'Conversation ID', nullable: true },
149167
conversation: CONVERSATION_OUTPUTS,
150168
payload: { type: 'json', description: 'Raw Help Scout webhook payload' },
151169
}
@@ -154,15 +172,19 @@ export function buildConversationEventOutputs(): Record<string, TriggerOutput> {
154172
export function buildConversationDeletedOutputs(): Record<string, TriggerOutput> {
155173
return {
156174
eventType: EVENT_TYPE_OUTPUT,
157-
conversationId: { type: 'number', description: 'ID of the deleted conversation' },
175+
conversationId: {
176+
type: 'number',
177+
description: 'ID of the deleted conversation',
178+
nullable: true,
179+
},
158180
payload: { type: 'json', description: 'Raw Help Scout webhook payload' },
159181
}
160182
}
161183

162184
export function buildCustomerEventOutputs(): Record<string, TriggerOutput> {
163185
return {
164186
eventType: EVENT_TYPE_OUTPUT,
165-
customerId: { type: 'number', description: 'Customer ID' },
187+
customerId: { type: 'number', description: 'Customer ID', nullable: true },
166188
customer: CUSTOMER_OUTPUTS,
167189
payload: { type: 'json', description: 'Raw Help Scout webhook payload' },
168190
}

0 commit comments

Comments
 (0)