Process new items from an RSS feed on a schedule
@pravin
code:
data:privatelast updated:5 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
Cron Scheduler
Deploy to configure a custom schedule
This workflow runs on Pipedream's servers and is triggered on a custom schedule.
steps.
rss
auth
to use OAuth tokens and API keys in code via theauths object
params
RSS URL

Enter the URL for the RSS feed.

https://www.reddit.com/.rss
string ·params.rss_url
ID Field Name

Enter the field name that contains the unique ID for each RSS item. The field name can vary for each feed. Common field names include id and guid.

id
string ·params.id_field_name
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
}
22
const Parser = require('rss-parser')
const parser = new Parser()
const feed = await parser.parseURL(params.rss_url)

// assumes only care about remembering last fetch instead of all previous
const checkpoint = this.$checkpoint || {}
const nextCheckpoint = {}

this.newItems = []
for (const item of feed.items || []) {
  const id = item[params.id_field_name]
  nextCheckpoint[id] = true
  if (!checkpoint[id]) this.newItems.push(item)
}

// checkpoint the items so we don't export them on the next workflow execution
this.$checkpoint = nextCheckpoint

// end the workflow execution if no new items were detected
if (!this.newItems.length) $end('No new items found')
steps.
process_new_items
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
}
7
// we're just console logging the title here
// you can write any node code to handle the feed
steps.rss.newItems.forEach(function(item) {
  console.log(item.title);
})