Delay Example, Workflow #1 - Receive HTTP request with user email, schedule task one day in future
@dylburger
code:
data:privatelast updated:3 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
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
schedule_task_in_future
auth
to use OAuth tokens and API keys in code via theauths object
params
Num Seconds

How many seconds in the future would you like to schedule the task?

86400
string ·params.numSeconds
Task Scheduler URL

Enter the URL as it appears in the Endpoint field of your Task Scheduler source

 
string ·params.taskSchedulerURL
Message

The message / payload to send to your task scheduler. Can be any string or JavaScript object. This message will be emitted by the task scheduler at the specified number of seconds in the future.

{{event.body}}
string ·params.message
Secret
123
string ·params.secret
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
// N seconds from now 
this.ts = (new Date(+new Date() + (params.numSeconds * 1000))).toISOString()

const headers = {
  "Content-Type": "application/json"
}
if (params.secret) {
  headers["x-pd-secret"] = params.secret
}

return await require("@pipedreamhq/platform").axios(this, {
  url: `${params.taskSchedulerURL}/schedule`,
  headers,
  data: {
    timestamp: this.ts,
    message: params.message,
  }
})