🎉 Pipedream raises $20M Series A 🎉
Read the blog post and TC Techcrunch article.
Email me new tweets
•@dylan•
•code:
•data:private•last updated:2 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 250,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.
CONSTANTS
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 invocations with$checkpoint.
async (event, steps) => {
1
2
3
4
}
5
// this.property exports values for use in future steps. We call these "step exports":
// https://docs.pipedream.com/workflows/steps/#step-exports.
this.searchTerm = "convert pdf"
// this.property exports values for use in future steps. We call these "step exports":
// https://docs.pipedream.com/workflows/steps/#step-exports.
this.searchTerm = "convert pdf"
steps.
search_twitter
Standard search API.
auth
(auths.twitter)
params
Q
{{steps.CONSTANTS.searchTerm}}
{{steps.CONSTANTS.searchTerm}}
string ·params.q
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
}
26
const oauthSignerUri = auths.twitter.oauth_signer_uri

const twitterParams = ["q", "tweet_mode", "geocode", "lang", "locale", "result_type", "count", "until", "since_id", "max_id", "include_entities"]
const {q, tweet_mode, geocode, lang, locale, result_type, count, until, since_id, max_id, include_entities} = params
p = params
p["tweet_mode"] = tweet_mode ? tweet_mode : "extended"

const config = {
    data: '',
    method: 'GET',
    url: `https://api.twitter.com/1.1/search/tweets.json`,
    params: p,
}

const token = {
    key: auths.twitter.oauth_access_token,
    secret: auths.twitter.oauth_refresh_token,
}

const signConfig = {
  token,
  oauthSignerUri
}
return (await require("@pipedreamhq/platform").axios(this, config, signConfig))
const oauthSignerUri = auths.twitter.oauth_signer_uri

const twitterParams = ["q", "tweet_mode", "geocode", "lang", "locale", "result_type", "count", "until", "since_id", "max_id", "include_entities"]
const {q, tweet_mode, geocode, lang, locale, result_type, count, until, since_id, max_id, include_entities} = params
p = params
p["tweet_mode"] = tweet_mode ? tweet_mode : "extended"

const config = {
    data: '',
    method: 'GET',
    url: `https://api.twitter.com/1.1/search/tweets.json`,
    params: p,
}

const token = {
    key: auths.twitter.oauth_access_token,
    secret: auths.twitter.oauth_refresh_token,
}

const signConfig = {
  token,
  oauthSignerUri
}
return (await require("@pipedreamhq/platform").axios(this, config, signConfig))
steps.
collect_and_format_tweets
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 invocations with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
8
9
10
11
}
12
// Format a message that contains the text of tweets returned by our search,
// which we'll send via email below.

// We reference step exports from previous steps here, e.g. steps.search_twitter.$return_value
this.message = `New ${steps.CONSTANTS.searchTerm} tweets:

${steps.search_twitter.$return_value.statuses.map(status => {
  return `New tweet from ${status.user.screen_name}: ${status.full_text}`
}).join("\n\n")}
`
// Format a message that contains the text of tweets returned by our search,
// which we'll send via email below.

// We reference step exports from previous steps here, e.g. steps.search_twitter.$return_value
this.message = `New ${steps.CONSTANTS.searchTerm} tweets:

${steps.search_twitter.$return_value.statuses.map(status => {
  return `New tweet from ${status.user.screen_name}: ${status.full_text}`
}).join("\n\n")}
`
steps.
email_me
Customize and send an email to the email address you registered with Pipedream. The email will be sent by notifications@pipedream.com.
params
Subject
New {{steps.CONSTANTS.searchTerm}} Tweets
New {{steps.CONSTANTS.searchTerm}} Tweets
string ·params.subject
Text
{{steps.collect_and_format_tweets.message}}
{{steps.collect_and_format_tweets.message}}
string ·params.text
Optional
code
async params => {
1
2
3
4
5
6
7
8
9
10
11
12
}
13
const options = {
  subject: params.subject,
  text: params.text,
}
if (params.html) {
  options.html = params.html
}
if (params.include_collaborators) {
  options.include_collaborators = params.include_collaborators
}
$send.email(options)
const options = {
  subject: params.subject,
  text: params.text,
}
if (params.html) {
  options.html = params.html
}
if (params.include_collaborators) {
  options.include_collaborators = params.include_collaborators
}
$send.email(options)