SendGrid Component
Send emails through SendGrid
Component key: sendgrid
Description
SendGrid is an email delivery service. This component allows you to send of emails through the SendGrid platform.
Connections
SendGrid API Key
Information about getting started and creating API keys with SendGrid can be found on their developer documentation site.
Input | Notes |
---|---|
API Key password / Required apiKey | Provide the API Key obtained from the developer console. |
Triggers
Webhook
Receive and validate webhook requests from SendGrid for webhooks you configure. | key: webhook
You can configure a SendGrid event webhook to send information to a Prismatic webhook URL when an email is received.
Example Payload for Webhook
Example Payload for Webhook
{
"payload": {
"headers": {
"accept": "*/*",
"Content-Type": "application/json; charset=UTF-8",
"User-Agent": "SendGrid Event API",
"Host": "hooks.example.prismatic.io"
},
"body": {
"data": [
{
"email": "someone@prismatic-example.com",
"timestamp": "1635784924",
"smtp-id": "<example.dfd.64b469@ismtpd-555>",
"event": "processed",
"category": [
"Example Email Category"
],
"sg_event_id": "WoOMEuhb-Mj_LEKrp8bC4g==",
"sg_message_id": "14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"
}
]
},
"rawBody": {
"data": {
"type": "Buffer",
"data": [
69,
120,
97,
109,
112,
108,
101
]
}
},
"queryParameters": null,
"webhookUrls": {
"Flow 1": "https://hooks.example.prismatic.io/trigger/EXAMPLEGbG93Q29uZmlnOmRlNmNmNDMyLTliNWMtN0005NDMxLTRmYzA4ZjViODgxOA=="
},
"webhookApiKeys": {
"Flow 1": [
"abc-123"
]
},
"customer": {
"externalId": "customer-example-external-id",
"name": "John Doe"
}
}
}
Actions
Raw Request
Send raw HTTP request to SendGrid | key: rawRequest
Input | Default | Notes | Example |
---|---|---|---|
Connection connection / Required connection | |||
Data string data | The HTTP body payload to send to the URL. | {"exampleKey": "Example Data"} | |
Debug Request boolean debugRequest | false | Enabling this flag will log out the current request. | |
File Data string Key Value List fileData | File Data to be sent as a multipart form upload. | [{key: "example.txt", value: "My File Contents"}] | |
File Data File Names string Key Value List fileDataFileNames | File names to apply to the file data inputs. Keys must match the file data keys above. | ||
Form Data string Key Value List formData | The Form Data to be sent as a multipart form upload. | [{"key": "Example Key", "value": new Buffer("Hello World")}] | |
Header string Key Value List headers | A list of headers to send with the request. | User-Agent: curl/7.64.1 | |
Max Retry Count string maxRetries | 0 | The maximum number of retries to attempt. | |
Method string / Required method | The HTTP method to use. | ||
Query Parameter string Key Value List queryParams | A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2. | ||
Response Type string / Required responseType | json | The type of data you expect in the response. You can request json, text, or binary data. | |
Retry On All Errors boolean retryAllErrors | false | If true, retries on all erroneous responses regardless of type. | |
Retry Delay (ms) string retryDelayMS | 0 | The delay in milliseconds between retries. | |
Timeout string timeout | The maximum time that a client will await a response to its request | 2000 | |
URL string / Required url | Input the path only (/templates), The base URL is already included (https://api.sendgrid.com/v3). For example, to connect to https://api.sendgrid.com/v3/templates, only /templates is entered in this field. | /templates | |
Use Exponential Backoff boolean useExponentialBackoff | false | Specifies whether to use a pre-defined exponential backoff strategy for retries. |
Send Email
Send a single email to one or more recipients | key: sendEmail
Input | Default | Notes | Example |
---|---|---|---|
BCC string bcc | The recipient's email address, or a comma-separated list of recipient email addresses to BCC. | example@email.com,example2@email.com | |
CC string cc | The recipient's email address, or a comma-separated list of recipient email addresses to CC. | example@email.com,example2@email.com | |
Attachment Content data content | Provide attachment data to send with the email. The 'File Name' field is required when using this input and should reference the data output from a previous action. | ||
Content Id string contentId | Provide the content Id of the attachment. This value is only required when you select 'inline'. | 12345 | |
Disposition string disposition | Specifies how you would like the attachment to be displayed. | inline | |
File Name string fileName | Provide a name for the file to attach. The 'Attachment Content' field is required when using this input. | reports.csv | |
File Type string fileType | The MIME type of the content you are attaching. | text/plain | |
From Email string / Required fromEmail | The sender's email address. | example@email.com | |
From Name string fromName | The sender's name. | John Doe | |
HTML text html | The optional HTML body of the email. | Hello from <b>Prismatic!</b> | |
Multiple Attachments code multipleAttachments | Provide an array of attachments to send with the email. See https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send#request-body for more information. | ||
Personalizations code personalizations | You can use this field to overwrite multiple properties of the email. For examples of which properties to use, checkout the SendGrid docs: https://docs.sendgrid.com/for-developers/sending-email/personalizations | ||
Reply To Email string replyToEmail | Email To Reply To. | example@email.com | |
Reply To Name string replyToName | Name to reply to. This field is only required when you provide a value for Reply To Email. | John Doe | |
Connection connection / Required sendGridConnection | |||
Subject string / Required subject | The email subject line. | Hello from Prismatic! | |
Text text / Required text | The text body of the email. | Here's the body of a notification. | |
To string / Required to | The recipient's email address, or a comma-separated list of recipient email addresses. | example@email.com,example2@email.com |
Example Payload for Send Email
Example Payload for Send Email
{
"data": [
{
"body": {
"message": "Example"
},
"statusCode": 200,
"headers": {}
},
{}
]
}
Send Multiple Emails
Send a separate email to each recipient | key: sendMultipleEmails
Input | Default | Notes | Example |
---|---|---|---|
BCC string bcc | The recipient's email address, or a comma-separated list of recipient email addresses to BCC. | example@email.com,example2@email.com | |
CC string cc | The recipient's email address, or a comma-separated list of recipient email addresses to CC. | example@email.com,example2@email.com | |
Attachment Content data content | Provide attachment data to send with the email. The 'File Name' field is required when using this input and should reference the data output from a previous action. | ||
Content Id string contentId | Provide the content Id of the attachment. This value is only required when you select 'inline'. | 12345 | |
Disposition string disposition | Specifies how you would like the attachment to be displayed. | inline | |
File Name string fileName | Provide a name for the file to attach. The 'Attachment Content' field is required when using this input. | reports.csv | |
File Type string fileType | The MIME type of the content you are attaching. | text/plain | |
From Email string / Required fromEmail | The sender's email address. | example@email.com | |
From Name string fromName | The sender's name. | John Doe | |
HTML text html | The optional HTML body of the email. | Hello from <b>Prismatic!</b> | |
Multiple Attachments code multipleAttachments | Provide an array of attachments to send with the email. See https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send#request-body for more information. | ||
Personalizations code personalizations | You can use this field to overwrite multiple properties of the email. For examples of which properties to use, checkout the SendGrid docs: https://docs.sendgrid.com/for-developers/sending-email/personalizations | ||
Reply To Email string replyToEmail | Email To Reply To. | example@email.com | |
Reply To Name string replyToName | Name to reply to. This field is only required when you provide a value for Reply To Email. | John Doe | |
Connection connection / Required sendGridConnection | |||
Subject string / Required subject | The email subject line. | Hello from Prismatic! | |
Text text / Required text | The text body of the email. | Here's the body of a notification. | |
To string / Required to | The recipient's email address, or a comma-separated list of recipient email addresses. | example@email.com,example2@email.com |
Example Payload for Send Multiple Emails
Example Payload for Send Multiple Emails
{
"data": [
{
"body": {
"message": "Example"
},
"statusCode": 200,
"headers": {}
},
{}
]
}