auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
// this.property exports values for use in future steps. We call these "step exports":
// https://docs.pipedream.com/workflows/steps/#step-exports.
this.searchTerm = "@raymondcamden";
if($checkpoint) console.log('yes cp', $checkpoint);
if($checkpoint && $checkpoint.lastId) {
this.since_id = $checkpoint.lastId;
console.log('i have a checkpoint', $checkpoint);
}
async
(params, auths) => {
}
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))
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
// Format a message that contains the text of tweets returned by our search,
// which we'll send via email below.
if(steps.search_twitter.$return_value.statuses.length === 0 ) {
$end("Ending due to no statuses");
}
// 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")}
`;
//remember last tweet
let lastId = steps.search_twitter.$return_value.statuses[0].id;
$checkpoint = {
lastId:lastId
};
console.log('saved checkpoint to '+lastId);
async
params => {
}
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)