Skip to content

Commit a26a1a9

Browse files
authored
fix(rss): add top-level title, link, pubDate fields to RSS trigger output (#2902)
* fix(rss): add top-level title, link, pubDate fields to RSS trigger output * fix(imap): add top-level fields to IMAP trigger output
1 parent 689037a commit a26a1a9

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

apps/sim/executor/utils/start-block.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,7 @@ function buildManualTriggerOutput(
377377
return mergeFilesIntoOutput(output, workflowInput)
378378
}
379379

380-
function buildIntegrationTriggerOutput(
381-
_finalInput: unknown,
382-
workflowInput: unknown
383-
): NormalizedBlockOutput {
380+
function buildIntegrationTriggerOutput(workflowInput: unknown): NormalizedBlockOutput {
384381
return isPlainObject(workflowInput) ? (workflowInput as NormalizedBlockOutput) : {}
385382
}
386383

@@ -430,7 +427,7 @@ export function buildStartBlockOutput(options: StartBlockOutputOptions): Normali
430427
return buildManualTriggerOutput(finalInput, workflowInput)
431428

432429
case StartBlockPath.EXTERNAL_TRIGGER:
433-
return buildIntegrationTriggerOutput(finalInput, workflowInput)
430+
return buildIntegrationTriggerOutput(workflowInput)
434431

435432
case StartBlockPath.LEGACY_STARTER:
436433
return buildLegacyStarterOutput(

apps/sim/lib/webhooks/imap-polling-service.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ export interface SimplifiedImapEmail {
5454
}
5555

5656
export interface ImapWebhookPayload {
57+
messageId: string
58+
subject: string
59+
from: string
60+
to: string
61+
cc: string
62+
date: string | null
63+
bodyText: string
64+
bodyHtml: string
65+
mailbox: string
66+
hasAttachments: boolean
67+
attachments: ImapAttachment[]
5768
email: SimplifiedImapEmail
5869
timestamp: string
5970
}
@@ -613,6 +624,17 @@ async function processEmails(
613624
}
614625

615626
const payload: ImapWebhookPayload = {
627+
messageId: simplifiedEmail.messageId,
628+
subject: simplifiedEmail.subject,
629+
from: simplifiedEmail.from,
630+
to: simplifiedEmail.to,
631+
cc: simplifiedEmail.cc,
632+
date: simplifiedEmail.date,
633+
bodyText: simplifiedEmail.bodyText,
634+
bodyHtml: simplifiedEmail.bodyHtml,
635+
mailbox: simplifiedEmail.mailbox,
636+
hasAttachments: simplifiedEmail.hasAttachments,
637+
attachments: simplifiedEmail.attachments,
616638
email: simplifiedEmail,
617639
timestamp: new Date().toISOString(),
618640
}

apps/sim/lib/webhooks/rss-polling-service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ interface RssFeed {
4848
}
4949

5050
export interface RssWebhookPayload {
51+
title?: string
52+
link?: string
53+
pubDate?: string
5154
item: RssItem
5255
feed: {
5356
title?: string
@@ -349,6 +352,9 @@ async function processRssItems(
349352
`${webhookData.id}:${itemGuid}`,
350353
async () => {
351354
const payload: RssWebhookPayload = {
355+
title: item.title,
356+
link: item.link,
357+
pubDate: item.pubDate,
352358
item: {
353359
title: item.title,
354360
link: item.link,

apps/sim/lib/webhooks/utils.server.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,9 @@ export async function formatWebhookInput(
686686
if (foundWebhook.provider === 'rss') {
687687
if (body && typeof body === 'object' && 'item' in body) {
688688
return {
689+
title: body.title,
690+
link: body.link,
691+
pubDate: body.pubDate,
689692
item: body.item,
690693
feed: body.feed,
691694
timestamp: body.timestamp,
@@ -697,6 +700,17 @@ export async function formatWebhookInput(
697700
if (foundWebhook.provider === 'imap') {
698701
if (body && typeof body === 'object' && 'email' in body) {
699702
return {
703+
messageId: body.messageId,
704+
subject: body.subject,
705+
from: body.from,
706+
to: body.to,
707+
cc: body.cc,
708+
date: body.date,
709+
bodyText: body.bodyText,
710+
bodyHtml: body.bodyHtml,
711+
mailbox: body.mailbox,
712+
hasAttachments: body.hasAttachments,
713+
attachments: body.attachments,
700714
email: body.email,
701715
timestamp: body.timestamp,
702716
}

0 commit comments

Comments
 (0)