Sendgrid

The Sendgrid service allows you to send automated emails from your app using the Twilio Sendgrid API.


Profile Settings

API Key

Enter your Sendgrid API Key here.


Connection Settings

From Address

Enter the from address to use when sending the email using this connection.


Operations/Commands

The Execute Connection Command block is available in both Page Flow and Cloud Flow. Using this block you can add logic to trigger the operations/commands supported by the Sendgrid service.

Send Email (Plain Text)

Use this command to send a plain-text email using the Sendgrid service.

Input Data

When invoking this operation, an object with the following properties is required:

Property
Type
Description

toAddr

One or more recipient email addresses. For multiple addresses use a list.

ccAddr

Optional. One or more CC email addresses. For multiple addresses use a list.

bccAddr

Optional. One or more BCC email addresses. For multiple addresses use a list.

subject

The subject for the email.

msg

The email's message or body.

customProps

Optional. For advanced users, this specifies an object with properties based on parameters used by the Sendgrid API.

Output

The Send Email (Plain Text) command does not provide any output beyond the Success/Fail status.

Send Email (HTML)

Use this command to send an email in HTML format using the Sendgrid service.

Input Data

When invoking this operation, an object with the following properties is required:

Property
Type
Description

toAddr

One or more recipient email addresses. For multiple addresses use a list.

ccAddr

Optional. One or more CC email addresses. For multiple addresses use a list.

bccAddr

Optional. One or more BCC email addresses. For multiple addresses use a list.

subject

The subject for the email.

msg

The email's message or body in HTML format.

msgText

The email's message or body in text format. Used for cases where the recipient's email client is unable to show the HTML formatted message.

customProps

Optional. For advanced users, this specifies an object with properties based on parameters used by the Sendgrid API.

Output

The Send Email (HTML) command does not provide any output beyond the Success/Fail status.

Send Email (Template)

Use this command to send an email using a pre-defined template in your Sendgrid account.

Input Data

When invoking this operation, an object with the following properties is required:

Property
Type
Description

toAddr

One or more recipient email addresses. For multiple addresses use a list.

ccAddr

Optional. One or more CC email addresses. For multiple addresses use a list.

bccAddr

Optional. One or more BCC email addresses. For multiple addresses use a list.

subject

The subject for the email.

templateId

The identifier of the Sendgrid template.

substitutions

Object containing dynamic dynamic substitutions.

substitutionWrappers

Optional. Defaults to {{ and }}. A list containing the starting and ending wrappers for identifying substitution properties.

customProps

Optional. For advanced users, this specifies an object with properties based on parameters used by the Sendgrid API.

Output

The Send Email (Template) command does not provide any output beyond the Success/Fail status.


Advanced Functionality

In your app's Cloud Flow Web Hooks and Background Tasks, the Custom Code block can be used to access and implement advanced functionality related to the Sendgrid email service.

To access the client initialized with credentials saved on this Sendgrid service connection, see the following example:

// To use a sendgrid client initialized with credentials
// provided in a Sendgrid connection
const sgMail = zingyConn.sendgrid(connectionName);

You may also initialize a separate Sendgrid client, by specifying account credentials directly:

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(apiKey);

After the sgMail object is initialized, you can use it to call into the Sendgrid library.

If you need to utilize Sendgrid API beyond simply sending emails, please see @sendgrid/client .

Last updated