Mail me new items from the LEAP feed
@tardate
code:
data:privatelast updated:4 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 800,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://leap.tardate.com/catalog/atom.xml
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.
generate_mail
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
8
9
10
}
11
// generate mail subject and body text based on new items
this.subject = 'New items (' + steps.rss.newItems.length + ') from the LEAP feed'
const headlines = []
steps.rss.newItems.forEach(function(item) {
  const headline = '* ' + item.title + ' ' + item.link + ' '
  console.log(headline)
  headlines.push(headline)
})
this.body = headlines.join('\n')
steps.
email_me
auth
to use OAuth tokens and API keys in code via theauths object
params
Optional
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
const options = {
  subject: steps.generate_mail.subject,
  text: steps.generate_mail.body,
}
if (params.html) {
  options.html = params.html
}
if (params.include_collaborators) {
  options.include_collaborators = params.include_collaborators
}
$send.email(options)