MCPcopy Index your code
hub / github.com/simstudioai/sim / processRssItems

Function processRssItems

apps/sim/lib/webhooks/polling/rss.ts:288–374  ·  view source on GitHub ↗
(
  items: RssItem[],
  feed: RssFeed,
  webhookData: PollWebhookContext['webhookData'],
  workflowData: PollWebhookContext['workflowData'],
  requestId: string,
  logger: Logger
)

Source from the content-addressed store, hash-verified

286}
287
288async function processRssItems(
289 items: RssItem[],
290 feed: RssFeed,
291 webhookData: PollWebhookContext['webhookData'],
292 workflowData: PollWebhookContext['workflowData'],
293 requestId: string,
294 logger: Logger
295): Promise<{ processedCount: number; failedCount: number }> {
296 let processedCount = 0
297 let failedCount = 0
298
299 for (const item of items) {
300 try {
301 const itemGuid =
302 item.guid ||
303 item.link ||
304 (item.title && item.pubDate ? `${item.title}-${item.pubDate}` : '')
305
306 if (!itemGuid) {
307 logger.warn(
308 `[${requestId}] Skipping RSS item with no identifiable GUID for webhook ${webhookData.id}`
309 )
310 continue
311 }
312
313 await pollingIdempotency.executeWithIdempotency(
314 'rss',
315 `${webhookData.id}:${itemGuid}`,
316 async () => {
317 const payload: RssWebhookPayload = {
318 title: item.title,
319 link: item.link,
320 pubDate: item.pubDate,
321 item: {
322 title: item.title,
323 link: item.link,
324 pubDate: item.pubDate,
325 guid: item.guid,
326 description: item.description,
327 content: item.content,
328 contentSnippet: item.contentSnippet,
329 author: item.author || item.creator,
330 categories: item.categories,
331 enclosure: item.enclosure,
332 isoDate: item.isoDate,
333 },
334 feed: {
335 title: feed.title,
336 link: feed.link,
337 description: feed.description,
338 },
339 timestamp: new Date().toISOString(),
340 }
341
342 const result = await processPolledWebhookEvent(
343 webhookData,
344 workflowData,
345 payload,

Callers 1

pollWebhookFunction · 0.85

Calls 6

getErrorMessageFunction · 0.90
errorMethod · 0.80
infoMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected