step

sendgrid

Send transactional emails via SendGrid with dynamic content and advanced features.

Overview

Send transactional emails via SendGrid with dynamic content and advanced features.

This step enables sending emails through SendGrid's enterprise email platform. Send plain text or HTML emails with template substitution for personalized content. Supports dynamic templates, CC/BCC recipients, scheduling, categories for tracking, and custom arguments for webhooks. Perfect for welcome emails, notifications, order confirmations, password resets, newsletters, and any transactional email needs. Track delivery, opens, clicks, and bounces through webhooks.

Setup: 1. Create a SendGrid account at https://signup.sendgrid.com/ 2. Generate an API key in Settings > API Keys (https://app.sendgrid.com/settings/api_keys) 3. Verify your sender identity (email or domain) at https://app.sendgrid.com/settings/sender_auth 4. Store your API key securely (e.g., as an environment variable: SENDGRID_API_KEY)

API Key: Required. Generate at https://app.sendgrid.com/settings/api_keys

Examples

Simple welcome email

Send a basic welcome email

type: sendgrid
api_key: ${env:SENDGRID_API_KEY}
operation: send_email
from_email: [email protected]
from_name: My Company
to: ${user.email}
subject: "Welcome ${user.name}!"
html: "<h1>Welcome!</h1><p>Thanks for signing up.</p>"
output_to: email_result

Order confirmation

Send order confirmation with details

type: sendgrid
api_key: ${env:SENDGRID_API_KEY}
operation: send_email
from_email: [email protected]
to: ${customer.email}
subject: "Order #${order.id} Confirmed"
html: "<h1>Hi ${customer.name}!</h1><p>Your order has been confirmed.</p><p>Total: $${order.total}</p>"
output_to: confirmation

Using dynamic template

Send email using SendGrid template

type: sendgrid
api_key: ${env:SENDGRID_API_KEY}
operation: send_template
from_email: [email protected]
to: ${user.email}
template_id: d-1234567890abcdef
template_data:
  user_name: ${user.name}
  confirm_url: ${confirmation.url}
output_to: template_email

Email with tracking

Send email with categories and custom args

type: sendgrid
api_key: ${env:SENDGRID_API_KEY}
operation: send_email
from_email: [email protected]
to: ${user.email}
subject: "Your weekly digest"
html: "<p>Here's what's new...</p>"
categories:
  - weekly_digest
custom_args:
  user_id: ${user.id}
output_to: digest

Configuration

Parameter Type Required Description
api_key string Yes SendGrid API key (starts with SG.). Use environment variables to keep this secure.
operation string No Operation to perform: 'send_email' or 'send_template'
Default: "send_email"
from_email string Yes Sender email address. Must be from a verified domain.
from_name string No Sender name displayed in email clients.
to string Yes Recipient email address(es). Can be a string or list.
subject string No Email subject line. Required for send_email operation.
html string No HTML email body content.
text string No Plain text email body content (fallback for HTML).
template_id string No SendGrid dynamic template ID (starts with d-). Required for send_template operation.
template_data string No Dynamic template data (variables to inject into template).
cc string No CC recipient email addresses.
bcc string No BCC recipient email addresses.
reply_to string No Reply-to email address.
categories string No Categories for email tracking and organization (max 10).
custom_args string No Custom arguments for tracking (passed to webhooks).
send_at string No Unix timestamp to schedule email for future delivery.
output_to string No Event key where the SendGrid response will be stored.
Default: "sendgrid"
timeout integer No Request timeout in seconds.
Default: 30

Base Configuration

These configuration options are available on all steps:

Parameter Type Default Description
name null Optional name for this step (for documentation and debugging)
description null Optional description of what this step does
retries integer 0 Number of retry attempts (0-10)
backoff_seconds number 0 Backoff (seconds) applied between retry attempts
retry_propagate boolean false If True, raise last exception after exhausting retries; otherwise swallow.