mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
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
This commit is contained in:
@@ -377,10 +377,7 @@ function buildManualTriggerOutput(
|
||||
return mergeFilesIntoOutput(output, workflowInput)
|
||||
}
|
||||
|
||||
function buildIntegrationTriggerOutput(
|
||||
_finalInput: unknown,
|
||||
workflowInput: unknown
|
||||
): NormalizedBlockOutput {
|
||||
function buildIntegrationTriggerOutput(workflowInput: unknown): NormalizedBlockOutput {
|
||||
return isPlainObject(workflowInput) ? (workflowInput as NormalizedBlockOutput) : {}
|
||||
}
|
||||
|
||||
@@ -430,7 +427,7 @@ export function buildStartBlockOutput(options: StartBlockOutputOptions): Normali
|
||||
return buildManualTriggerOutput(finalInput, workflowInput)
|
||||
|
||||
case StartBlockPath.EXTERNAL_TRIGGER:
|
||||
return buildIntegrationTriggerOutput(finalInput, workflowInput)
|
||||
return buildIntegrationTriggerOutput(workflowInput)
|
||||
|
||||
case StartBlockPath.LEGACY_STARTER:
|
||||
return buildLegacyStarterOutput(
|
||||
|
||||
@@ -54,6 +54,17 @@ export interface SimplifiedImapEmail {
|
||||
}
|
||||
|
||||
export interface ImapWebhookPayload {
|
||||
messageId: string
|
||||
subject: string
|
||||
from: string
|
||||
to: string
|
||||
cc: string
|
||||
date: string | null
|
||||
bodyText: string
|
||||
bodyHtml: string
|
||||
mailbox: string
|
||||
hasAttachments: boolean
|
||||
attachments: ImapAttachment[]
|
||||
email: SimplifiedImapEmail
|
||||
timestamp: string
|
||||
}
|
||||
@@ -613,6 +624,17 @@ async function processEmails(
|
||||
}
|
||||
|
||||
const payload: ImapWebhookPayload = {
|
||||
messageId: simplifiedEmail.messageId,
|
||||
subject: simplifiedEmail.subject,
|
||||
from: simplifiedEmail.from,
|
||||
to: simplifiedEmail.to,
|
||||
cc: simplifiedEmail.cc,
|
||||
date: simplifiedEmail.date,
|
||||
bodyText: simplifiedEmail.bodyText,
|
||||
bodyHtml: simplifiedEmail.bodyHtml,
|
||||
mailbox: simplifiedEmail.mailbox,
|
||||
hasAttachments: simplifiedEmail.hasAttachments,
|
||||
attachments: simplifiedEmail.attachments,
|
||||
email: simplifiedEmail,
|
||||
timestamp: new Date().toISOString(),
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ interface RssFeed {
|
||||
}
|
||||
|
||||
export interface RssWebhookPayload {
|
||||
title?: string
|
||||
link?: string
|
||||
pubDate?: string
|
||||
item: RssItem
|
||||
feed: {
|
||||
title?: string
|
||||
@@ -349,6 +352,9 @@ async function processRssItems(
|
||||
`${webhookData.id}:${itemGuid}`,
|
||||
async () => {
|
||||
const payload: RssWebhookPayload = {
|
||||
title: item.title,
|
||||
link: item.link,
|
||||
pubDate: item.pubDate,
|
||||
item: {
|
||||
title: item.title,
|
||||
link: item.link,
|
||||
|
||||
@@ -686,6 +686,9 @@ export async function formatWebhookInput(
|
||||
if (foundWebhook.provider === 'rss') {
|
||||
if (body && typeof body === 'object' && 'item' in body) {
|
||||
return {
|
||||
title: body.title,
|
||||
link: body.link,
|
||||
pubDate: body.pubDate,
|
||||
item: body.item,
|
||||
feed: body.feed,
|
||||
timestamp: body.timestamp,
|
||||
@@ -697,6 +700,17 @@ export async function formatWebhookInput(
|
||||
if (foundWebhook.provider === 'imap') {
|
||||
if (body && typeof body === 'object' && 'email' in body) {
|
||||
return {
|
||||
messageId: body.messageId,
|
||||
subject: body.subject,
|
||||
from: body.from,
|
||||
to: body.to,
|
||||
cc: body.cc,
|
||||
date: body.date,
|
||||
bodyText: body.bodyText,
|
||||
bodyHtml: body.bodyHtml,
|
||||
mailbox: body.mailbox,
|
||||
hasAttachments: body.hasAttachments,
|
||||
attachments: body.attachments,
|
||||
email: body.email,
|
||||
timestamp: body.timestamp,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user