Reference · Tools

SendGrid

Manage contacts, mailing lists, and send transactional or template-based emails with attachments via the SendGrid API.

Action (binary) Communication v1 Binary data

The SendGrid node manages contacts and mailing lists and sends transactional or template-based email with attachments. A typical build is upserting customers into a list and sending them a templated onboarding message.

Node type
Action (binary)
Parameters
34
Outputs
Output, Error
Credentials
SendGrid API

SendGrid

Send emails and manage contacts/lists via SendGrid

Overview

The SendGrid tool integrates with the Twilio SendGrid email delivery platform. It supports three resources: (1) Contact — create/update (upsert), get by ID or email, get many with SGQL queries, and delete contacts. Note that contact upsert is a bulk/batch operation that collects all input items into a single API call. (2) List — create, get, get many, update, and delete mailing lists. (3) Mail — send transactional emails with plain text or HTML content, or use dynamic templates with template data. Emails can include binary file attachments from upstream items (base64-encoded in the JSON payload). Supports CC, BCC, reply-to, custom headers, categories, IP pool selection, scheduled send, and sandbox mode. Uses the SendGrid v3 REST API with Bearer token authentication.

Category: Communication
Tool Name: sendgrid
Version: 1

Appearance: Icon: lucide-Mail | Color: #1A82E2

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires SendGrid API credentials. See the Credentials Guide for setup instructions.

Resources

ResourceValue
Contactcontact
Listlist
Mailmail

Operations

OperationValueDescription
Contact: Create or UpdateupsertCreate a new contact or update if it already exists (upsert)
Contact: DeletedeleteDelete contacts
Contact: GetgetGet a contact by ID or email
Contact: Get ManygetAllGet many contacts
List: CreatecreateCreate a mailing list
List: DeletedeleteDelete a mailing list
List: GetgetGet a mailing list
List: Get ManygetAllGet many mailing lists
List: UpdateupdateUpdate a mailing list
Mail: SendsendSend an email

Parameters

Contact: Create or Update

ParameterTypeRequiredDefaultDescription
EmailstringYesPrimary email for the contact. Supports expressions.
Additional FieldscollectionNo{}Optional contact details to set alongside the email address.
— First NamestringNoContact first name.
— Last NamestringNoContact last name.
— Address Line 1stringNoStreet address line 1.
— Address Line 2stringNoStreet address line 2.
— CitystringNoCity.
— CountrystringNoCountry.
— Postal CodestringNoPostal / ZIP code.
— State/Province/RegionstringNoState, province, or region.
— Alternate EmailsstringNoComma-separated list of alternate email addresses for this contact.
— List IDsstringNoComma-separated list IDs to add the contact to. Get list IDs from List: Get Many.
— Custom Fields (JSON)jsonNo{}JSON object mapping custom field IDs to values. E.g., {“e1_T”:“value1”,“e2_N”:123}. Get field IDs from GET /marketing/field_definitions.

Contact: Delete

ParameterTypeRequiredDefaultDescription
Delete AllbooleanNofalseWhether to delete all contacts.
Contact IDsstringNoComma-separated contact IDs to delete. (shown when Delete All is false)

Contact: Get

ParameterTypeRequiredDefaultDescription
ByoptionsYesidLook up contact by ID or email.
Options: id, email
Contact IDstringYesThe ID of the contact to retrieve. (shown when By is id)
EmailstringYesThe email address of the contact to retrieve. (shown when By is email)

Contact: Get Many

ParameterTypeRequiredDefaultDescription
Return AllbooleanNofalseWhether to return all results or only up to a given limit.
LimitnumberNo100Max number of results to return. (shown when Return All is false)
FilterscollectionNo{}Optional filter applied to the contact lookup.
— QuerystringNoSGQL query to filter contacts. E.g., “email LIKE ’%@example.com%’”.

List: Create

ParameterTypeRequiredDefaultDescription
NamestringYesName of the mailing list. Supports expressions.

List: Delete

ParameterTypeRequiredDefaultDescription
List IDstringYesID of the mailing list to delete.
Delete ContactsbooleanNofalseWhether to also delete all contacts on the list.

List: Get

ParameterTypeRequiredDefaultDescription
List IDstringYesID of the mailing list.
Contact SamplebooleanNofalseWhether to include a sample of contacts in the response.

List: Get Many

ParameterTypeRequiredDefaultDescription
Return AllbooleanNofalseWhether to return all results or only up to a given limit.
LimitnumberNo100Max number of results to return. (shown when Return All is false)

List: Update

ParameterTypeRequiredDefaultDescription
List IDstringYesID of the mailing list to update.
NamestringYesNew name for the mailing list.

Mail: Send

ParameterTypeRequiredDefaultDescription
Sender EmailstringNoEmail address of the sender.
Sender NamestringNoDisplay name of the sender.
Recipient EmailstringNoComma-separated list of recipient email addresses. Supports expressions.
Dynamic TemplatebooleanYesfalseWhether this email will use a dynamic template.
SubjectstringNoSubject line of the email. (shown when Dynamic Template is false)
MIME TypeoptionsNotext/plainContent type of the email body. (shown when Dynamic Template is false)
Options: text/plain, text/html
Message BodystringYesThe body content of the email. (shown when Dynamic Template is false)
Template IDstringNoID of the dynamic template. Get template IDs from GET /templates?generations=dynamic. (shown when Dynamic Template is true)
Dynamic Template FieldsfixedCollectionNo{}Merge variables passed to the dynamic template, added under a fields group. (shown when Dynamic Template is true)
— KeystringNoTemplate variable name.
— ValuestringNoValue for the template variable.
Additional FieldscollectionNo{}Optional delivery settings for the message.
— AttachmentsstringNoComma-separated list of binary property names to attach to the email. Names are case-sensitive — see the upstream node’s Binary Data panel for the exact names to use.
— BCC EmailstringNoComma-separated list of BCC recipient email addresses.
— CC EmailstringNoComma-separated list of CC recipient email addresses.
— CategoriesstringNoComma-separated list of categories. Each may not exceed 255 characters.
— Enable SandboxbooleanNofalseWhether to use the sandbox for testing email-sending functionality.
— HeadersfixedCollectionNo{}Custom headers added to the message, under a details group.
— — KeystringNoHeader key.
— — ValuestringNoHeader value.
— IP Pool NamestringNoThe IP Pool to send this email from.
— Reply-To EmailstringNoComma-separated list of reply-to email addresses.
— Send AtdateTimeNoWhen to deliver the email. Scheduling more than 72 hours in advance is forbidden.

All Operations

ParameterTypeRequiredDefaultDescription
Max ConcurrencynumberNo10Maximum number of items to process concurrently.

Output Data

The SendGrid response is merged onto the item JSON at the top level, so downstream nodes read its fields directly ({{ $json.id }}). The rest of the incoming item JSON passes through unchanged and binary data is forwarded. Most operations produce one output item per input item; the two Get Many operations fan out instead.

OperationWhat lands on the output item
contact / upsertOne item per input item. Every input item is collected into a single API call, and that one response is merged onto all of them.
contact / getOne item per input item, carrying the matched contact record. Looking up by email searches and keeps the first match, so an unknown address yields no contact fields.
contact / getAllFans out — one output item per contact returned. When nothing matches, a single item is emitted carrying contacts: [].
contact / deleteOne item per input item, carrying the delete response.
list / create, get, updateOne item per input item, carrying the mailing list record.
list / getAllFans out — one output item per mailing list returned. When nothing matches, a single item is emitted carrying lists: [].
list / deleteOne item per input item, carrying success: true.
mail / sendOne item per input item, carrying messageId — SendGrid’s message ID for the accepted send, or an empty string when the API returns none. The message body itself is not echoed back.

Failed items are routed to the Error port in errorPort mode, carrying an _error object.

Usage Examples

  • Send an HTML email with a PDF attachment via SendGrid
  • Send a dynamic template email with merge variables
  • Create or update a marketing contact in SendGrid
  • Get all contacts matching an SGQL query
  • Create a new mailing list
  • Delete a mailing list and its contacts
  • Send a scheduled email with CC and BCC recipients

Example Configuration

Create or update a marketing contact from each incoming item and add it to a list:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "contact",
    "operation": "upsert",
    "email": "{{ $json.email }}",
    "additionalFields": {
      "firstName": "{{ $json.firstName }}",
      "lastName": "{{ $json.lastName }}",
      "city": "{{ $json.city }}",
      "listIds": "{{ $json.listId }}",
      "customFields": "{\"e1_T\": \"{{ $json.company }}\"}"
    }
  }
}

Look a contact up by email address:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "contact",
    "operation": "get",
    "by": "email",
    "email": "{{ $json.email }}"
  }
}

Fetch contacts matching an SGQL query, one output item per contact:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "contact",
    "operation": "getAll",
    "returnAll": false,
    "limit": 100,
    "filters": {
      "query": "email LIKE '%@company.com%'"
    }
  }
}

Delete specific contacts by ID:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "contact",
    "operation": "delete",
    "deleteAll": false,
    "ids": "{{ $json.contactIds }}"
  }
}

Create a mailing list:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "list",
    "operation": "create",
    "name": "Newsletter Subscribers"
  }
}

Rename an existing mailing list:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "list",
    "operation": "update",
    "listId": "{{ $json.id }}",
    "name": "Updated Newsletter List"
  }
}

Delete a mailing list along with the contacts on it:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "list",
    "operation": "delete",
    "listId": "{{ $json.id }}",
    "deleteContacts": true
  }
}

Send an HTML email with an upstream file attached, a CC address and a custom header:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "mail",
    "operation": "send",
    "fromEmail": "billing@company.com",
    "fromName": "Billing Department",
    "toEmail": "{{ $json.email }}",
    "dynamicTemplate": false,
    "subject": "Your invoice {{ $json.invoiceNumber }}",
    "contentType": "text/html",
    "contentValue": "<p>Please find your invoice attached.</p>",
    "additionalFields": {
      "attachments": "data",
      "ccEmail": "accounting@company.com",
      "categories": "billing,invoice",
      "headers": {
        "details": [
          {
            "key": "X-Invoice-Number",
            "value": "{{ $json.invoiceNumber }}"
          }
        ]
      }
    }
  }
}

Send a dynamic template email with merge variables, a BCC archive address and a scheduled delivery time:

{
  "type": "sendgrid",
  "parameters": {
    "resource": "mail",
    "operation": "send",
    "fromEmail": "orders@shop.com",
    "fromName": "Online Shop",
    "toEmail": "{{ $json.email }}",
    "dynamicTemplate": true,
    "templateId": "d-123456789",
    "dynamicTemplateFields": {
      "fields": [
        {
          "key": "customerName",
          "value": "{{ $json.name }}"
        },
        {
          "key": "orderNumber",
          "value": "{{ $json.orderId }}"
        }
      ]
    },
    "additionalFields": {
      "bccEmail": "orders-archive@shop.com",
      "sendAt": "{{ $json.deliverAt }}"
    }
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Manage SendGrid contacts, mailing lists, and send transactional or template-based emails with binary file attachments.

Notes

  • Create or Update is a batch call. Every input item reaching the node is folded into one contact upsert request, and the List IDs supplied by all of those items are combined into a single set applied to the whole batch. Every item still gets an output item.
  • Attachments name binary properties, not files. Put the property names from the upstream node’s Binary Data panel in Attachments — for example data — not file paths. A name that is not on the item is skipped, and the send still goes out.
  • Attachment size is capped. The node refuses a send whose attachments total more than 25 MB of raw bytes, because base64 encoding inflates them past SendGrid’s request size limit.
  • Dynamic Template switches the whole content model. With it on, Subject, MIME Type and Message Body disappear and the template plus its merge fields supply the content; with it off, Template ID and Dynamic Template Fields disappear.
  • Sandbox mode validates without delivering. Turn on Enable Sandbox to exercise a send end to end without SendGrid actually mailing anyone.

Frequently asked questions

How does Create or Update handle a batch?

It is a batch call: every input item reaching the node is folded into one contact upsert request, and the List IDs supplied by all those items are combined into a single set applied to the whole batch. Every item still gets an output item.

How do attachments work?

Attachments name binary properties rather than file paths — put the property name in, and the node takes the bytes from the incoming item.

Can it send from a template?

Yes, both transactional and template-based sends are supported, so per-recipient content can come from SendGrid's own templates.

Which credential does it need?

A SendGrid API credential.

Build with the SendGrid node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need SendGrid API credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.