Kottke to ToWatchList
@nickv2002
code:
data:privatelast updated:8 months 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.

http://feeds.kottke.org/main
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.
end_based_on_condition

End workflow execution if a condition is met

configure

The message that will be displayed when the workflow continues

 
Enter a value for Reason for continuing

The message that will be displayed when the workflow ends

 
Enter a value for Reason for ending

The 1st of 2 values to compare

 
Enter a value for Initial value

Choose a condition

steps.
ToWatchListScan
auth
to use OAuth tokens and API keys in code via theauths object
params
ToWatchList API Key

API Key from ToWatchList.com/Tools

 
69a837d32e280bbcf49110ce708d7a74
string ·params.towatchlist_api_key
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
steps.rss.newItems.forEach(function(item) {
  if (item.link !== "https://kottke.org/quick-links" && item.author !== "Edith Zimmerman") {
    $send.http({
      method: "GET",
      url: 'https://towatchlist.com/api/v1/scanurl?uid=' + params.towatchlist_api_key + '&l=' + encodeURIComponent(item.link)
    });
  }
})