Delay Example, Workflow #2 - send email after delay
@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
active
last updated:-last event:-
steps.
send_email
Send an email to a recipient.
auth
(auths.sendgrid)
params
To email

The email address of the recipient.

{{event.message.email}}
string ·params.to_email
Subject

The subject line of your email.

Welcome!
string ·params.subject
From email

The email address of the sender.

support@pipedream.com
string ·params.from_email
Reply to_email

The email address to which responses will be sent.

support@pipedream.com
string ·params.reply_to_email
Type

The mime type of the content you are including in your email. For example, text/plain or text/html.

text/plain
string ·params.type
Value

The actual content of the specified mime type that you are including in your email.

Welcome to Pipedream!
string ·params.value
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
}
41
const axios = require('axios')

return await require("@pipedreamhq/platform").axios(this, {
  url: `https://api.sendgrid.com/v3/mail/send`,
  headers: {
    Authorization: `Bearer ${auths.sendgrid.api_key}`,
  },
  method: 'POST',
  data: {
    "personalizations": [{
      "to": [{
        "email": params.to_email,
        "name": params.to_name
      }],
      "subject": params.subject,
      "headers": params.headers,
      "substitutions": params.substitutions,
      "custom_args": params.custom_args,
      "send_at": params.send_at
    }],
    "from": {
      "email": params.from_email,
      "name": params.from_name
    },
    "reply_to": {
      "email": params.reply_to_email,
      "name": params.reply_to_name
    },
    "content": [{
      "type": params.type,
      "value": params.value
    }],
    "template_id": params.template_id,
    "sections": params.sections,
    "categories": params.categories,
    "batch_id": params.batch_id,
    "ip_pool_name": params.ip_pool_name
  }
})