ByteChef LogoByteChef

Sendgrid

Trusted for reliable email delivery at scale.

Categories: Communication, Marketing Automation

Type: sendgrid/v1


Connections

Version: 1

Bearer Token

Properties

NameLabelTypeDescriptionRequired
tokenTokenSTRINGtrue

Connection Setup

  1. Open your Dashboard: https://app.sendgrid.com .
  2. Click on Settings and choose API Keys.
  3. Click on Create API Key.
  4. Enter API Key Name, choose Full Access permissions and click on Create & View.
  5. Copy your generated API key and use it in Bytechef.

Actions

Send Email

Name: sendEmail

Sends an email.

Properties

NameLabelTypeDescriptionRequired
fromFromSTRINGEmail address from which you want to send.true
toToARRAY
Items [STRING]
Email addresses which you want to send to.true
ccCCARRAY
Items [STRING]
Email address which receives a copy.false
subjectSubjectSTRINGSubject of your email.true
textMessage BodySTRINGThe message you want to send.true
typeMessage TypeSTRING
Options text/plain, text/html
Message type for your content.true
attachmentsAttachmentsARRAY
Items [FILE_ENTRY]
A list of attachments you want to include with the email.false

Example JSON Structure

{
  "label" : "Send Email",
  "name" : "sendEmail",
  "parameters" : {
    "from" : "",
    "to" : [ "" ],
    "cc" : [ "" ],
    "subject" : "",
    "text" : "",
    "type" : "",
    "attachments" : [ {
      "extension" : "",
      "mimeType" : "",
      "name" : "",
      "url" : ""
    } ]
  },
  "type" : "sendgrid/v1/sendEmail"
}

Output

This action does not produce any output.

Send Dynamic Template

Name: sendDynamicTemplate

Send an email using a dynamic template.

Properties

NameLabelTypeDescriptionRequired
fromFromSTRINGEmail address from which you want to send.true
toToARRAY
Items [STRING]
Email addresses which you want to send to.true
ccCCARRAY
Items [STRING]
Email address which receives a copy.false
template_idTemplate IDSTRINGDynamic template ID.true
dynamic_template_dataDynamic Template DataOBJECT
Properties {}
Data passed to the SendGrid dynamic template.false
attachmentsAttachmentsARRAY
Items [FILE_ENTRY]
A list of attachments you want to include with the email.false

Example JSON Structure

{
  "label" : "Send Dynamic Template",
  "name" : "sendDynamicTemplate",
  "parameters" : {
    "from" : "",
    "to" : [ "" ],
    "cc" : [ "" ],
    "template_id" : "",
    "dynamic_template_data" : { },
    "attachments" : [ {
      "extension" : "",
      "mimeType" : "",
      "name" : "",
      "url" : ""
    } ]
  },
  "type" : "sendgrid/v1/sendDynamicTemplate"
}

Output

This action does not produce any output.

Find Template ID

To find the Template ID, click here.

List Contact Lists

Name: listContactLists

Lists all Marketing Campaigns contact lists in the SendGrid account.

Example JSON Structure

{
  "label" : "List Contact Lists",
  "name" : "listContactLists",
  "type" : "sendgrid/v1/listContactLists"
}

Output

Type: ARRAY

Items Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the contact list.
nameSTRINGThe name of the contact list.
contact_countINTEGERThe number of contacts on the list.

Output Example

[ {
  "id" : "",
  "name" : "",
  "contact_count" : 1
} ]

List Senders

Name: listSenders

Lists all Marketing Campaigns senders. Only verified senders can be used to send a Single Send.

Example JSON Structure

{
  "label" : "List Senders",
  "name" : "listSenders",
  "type" : "sendgrid/v1/listSenders"
}

Output

Type: ARRAY

Items Type: OBJECT

Properties

NameTypeDescription
idINTEGERThe ID of the sender.
nicknameSTRINGThe nickname of the sender.
fromOBJECT
Properties {STRING(email), STRING(name)}
reply_toOBJECT
Properties {STRING(email), STRING(name)}
verifiedBOOLEAN
Options true, false
Whether the sender is verified.
lockedBOOLEAN
Options true, false
Whether the sender is used by a draft or scheduled send.

Output Example

[ {
  "id" : 1,
  "nickname" : "",
  "from" : {
    "email" : "",
    "name" : ""
  },
  "reply_to" : {
    "email" : "",
    "name" : ""
  },
  "verified" : false,
  "locked" : false
} ]

Create Single Send

Name: createSingleSend

Creates a draft Marketing Campaigns Single Send. Use Schedule Single Send to send it.

Properties

NameLabelTypeDescriptionRequired
nameNameSTRINGThe name of the Single Send.true
subjectSubjectSTRINGThe subject line of the email.true
htmlContentHTML ContentSTRINGThe HTML content of the email.true
senderIdSender IDINTEGERThe ID of the verified sender the email is sent from.true
listIdsList IDsARRAY
Items [STRING]
The IDs of the contact lists the Single Send is sent to.true
suppressionGroupIdUnsubscribe Group IDINTEGERThe ID of the unsubscribe group recipients can opt out of. Scheduling requires either an unsubscribe group or a custom unsubscribe URL.false
customUnsubscribeUrlCustom Unsubscribe URLSTRINGThe URL of your own unsubscribe page, used instead of an unsubscribe group.false

Example JSON Structure

{
  "label" : "Create Single Send",
  "name" : "createSingleSend",
  "parameters" : {
    "name" : "",
    "subject" : "",
    "htmlContent" : "",
    "senderId" : 1,
    "listIds" : [ "" ],
    "suppressionGroupId" : 1,
    "customUnsubscribeUrl" : ""
  },
  "type" : "sendgrid/v1/createSingleSend"
}

Output

Type: OBJECT

Properties

NameTypeDescription
idSTRINGThe ID of the Single Send. Pass it to Schedule Single Send.
nameSTRINGThe name of the Single Send.
statusSTRINGThe status of the Single Send: draft, scheduled or triggered.
send_atSTRINGThe scheduled send time, when one is set.
send_toOBJECT
Properties {[STRING](list_ids)}
email_configOBJECT
Properties {STRING(subject), STRING(html_content), INTEGER(sender_id), INTEGER(suppression_group_id), STRING(custom_unsubscribe_url)}
created_atSTRINGThe time the Single Send was created.
updated_atSTRINGThe time the Single Send was last updated.

Output Example

{
  "id" : "",
  "name" : "",
  "status" : "",
  "send_at" : "",
  "send_to" : {
    "list_ids" : [ "" ]
  },
  "email_config" : {
    "subject" : "",
    "html_content" : "",
    "sender_id" : 1,
    "suppression_group_id" : 1,
    "custom_unsubscribe_url" : ""
  },
  "created_at" : "",
  "updated_at" : ""
}

Before you schedule

SendGrid creates the Single Send as a draft. Before you schedule it with Schedule Single Send, make sure that:

  • The sender is verified. Use List Senders to check the verified flag.
  • The Single Send has either an Unsubscribe Group ID or a Custom Unsubscribe URL.
  • The API key has access to Marketing Campaigns. A key with Full Access permissions does.

Schedule Single Send

Name: scheduleSingleSend

Schedules a Marketing Campaigns Single Send, or sends it immediately.

Properties

NameLabelTypeDescriptionRequired
singleSendIdSingle Send IDSTRINGThe ID of the Single Send, as returned by Create Single Send.true
sendAtSend AtSTRINGWhen to send the Single Send: a future ISO 8601 date-time such as 2026-12-01T09:00:00Z, or now to send it immediately.true

Example JSON Structure

{
  "label" : "Schedule Single Send",
  "name" : "scheduleSingleSend",
  "parameters" : {
    "singleSendId" : "",
    "sendAt" : ""
  },
  "type" : "sendgrid/v1/scheduleSingleSend"
}

Output

Type: OBJECT

Properties

NameTypeDescription
send_atSTRINGThe time the Single Send is scheduled to be sent.
statusSTRINGThe status of the Single Send, scheduled on success.

Output Example

{
  "send_at" : "",
  "status" : ""
}

What to do if your action is not listed here?

If this component doesn't have the action you need, you can use Custom Action to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.

To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.


Additional Instructions

How to find Template ID

  • Method 1: Via UI

To find a Template ID, open your dashboard. In the left bar choose Email API -> Dynamic Templates. Expand the template you want to use and there you will find Template ID.

  • Method 2: Via API

Use the GET /templates?generations=dynamic endpoint to retrieve a list of all dynamic templates and their IDs.

How is this guide?

Last updated on

On this page