Skip to content

$io.sendgrid ​

Server API reference.

Functions ​

$io.sendgrid.clientApiCall ​

Make direct HTTP API calls to the SendGrid platform using a configured connection.

Usage ​

js
$io.sendgrid.clientApiCall(connectionName, url, method, queryParams, body, headers)

Description ​

This function performs a direct HTTP request to the SendGrid API using the configured API key and client. Supports GET, POST, PUT, DELETE, and other methods. Allows access to any SendGrid REST endpoint, including those not covered by the standard wrapper methods. Custom endpoints, query parameters, request bodies, and headers are supported, with the raw response returned.

Usage Scenarios ​

  • Call advanced or rarely used SendGrid API endpoints
  • Perform custom operations not covered by built-in wrappers
  • Integrate new SendGrid features before official SDK support

Parameters ​

connectionName ​

Type: String

Required: Yes

The name of the SendGrid connection configured in the ioLoop app.

url ​

Type: String

Required: Yes

The relative or full URL to the SendGrid API endpoint (e.g., '/v3/user/credits').

method ​

Type: String

Required: Yes

HTTP method to use (e.g., 'GET', 'POST', 'PUT', 'DELETE').

queryParams ​

Type: Object

Required: No

Optional query string parameters as key-value pairs.

body ​

Type: Object

Required: No

Optional request body, used for POST/PUT methods.

headers ​

Type: Object

Required: No

Optional headers to include in the request.

Output ​

Type: Promise

Resolves to an object:

$io.sendgrid.sendEmailWithTemplate ​

Send an email using a dynamic SendGrid template.

Usage ​

js
$io.sendgrid.sendEmailWithTemplate(connectionName, toAddr, subject, templateId, substitutions, options)

Description ​

This function sends an email to one or more recipients using a specified dynamic template in your SendGrid account. Template substitutions are applied as key-value pairs, supporting fully personalized emails. Sender address is set from the connection profile. CC, BCC, and scheduled sending are supported.

Usage Scenarios ​

  • Send transactional or marketing emails using predefined SendGrid templates
  • Personalize emails with dynamic content using template substitutions
  • Automate templated communications such as receipts, onboarding, or password resets

Parameters ​

connectionName ​

Type: String

Required: Yes

The name of the SendGrid connection configured in the ioLoop app.

toAddr ​

Type: String | Array of Strings

Required: Yes

Recipient email address or list of addresses.

subject ​

Type: String

Required: Yes

The subject line of the email.

templateId ​

Type: String

Required: Yes

The SendGrid template ID to use.

substitutions ​

Type: Object

Required: Yes

Key-value pairs for dynamic template variables.

options ​

Type: Object

Required: No

Optional settings for the email. Can include:

  • ccAddr: String | Array of Strings
  • bccAddr: String | Array of Strings
  • sendAt: Number (scheduled send, in Unix timestamp seconds)

Output ​

Type: Promise

Resolves to an object:

$io.sendgrid.sendHtmlEmail ​

Send an HTML email using a configured SendGrid connection.

Usage ​

js
$io.sendgrid.sendHtmlEmail(connectionName, toAddr, subject, html, options)

Description ​

This function sends an HTML email to one or more recipients using the specified SendGrid connection. The sender address is determined by the connection profile. Supports optional plain text body, CC, BCC, and scheduled sending. Returns a status object indicating success or failure.

Usage Scenarios ​

  • Send visually formatted transactional or marketing emails
  • Deliver branded notification emails with custom HTML templates
  • Automate sending HTML-based messages from web forms or workflows

Parameters ​

connectionName ​

Type: String

Required: Yes

The name of the SendGrid connection configured in the ioLoop app.

toAddr ​

Type: String | Array of Strings

Required: Yes

Recipient email address or list of addresses.

subject ​

Type: String

Required: Yes

The subject line of the email.

html ​

Type: String

Required: Yes

The HTML content of the email.

options ​

Type: Object

Required: No

Optional settings for the email. Can include:

  • ccAddr: String | Array of Strings
  • bccAddr: String | Array of Strings
  • msgText: String (plain text alternative body)
  • sendAt: Number (scheduled send, in Unix timestamp seconds)

Output ​

Type: Promise

Resolves to an object:

$io.sendgrid.sendTextEmail ​

Send a plain text email using a configured SendGrid connection.

Usage ​

js
$io.sendgrid.sendTextEmail(connectionName, toAddr, subject, msg, options)

Description ​

This function sends a plain text email to one or more recipients using the specified SendGrid connection. The sender address is determined by the connection profile. Optional fields allow you to specify CC, BCC, and scheduling. Returns a status object indicating success or failure.

Usage Scenarios ​

  • Programmatically send notifications or alerts via email
  • Send transactional messages (e.g., password resets, confirmations)
  • Automate sending emails from workflows or forms

Parameters ​

connectionName ​

Type: String

Required: Yes

The name of the SendGrid connection configured in the ioLoop app.

toAddr ​

Type: String | Array of Strings

Required: Yes

Recipient email address or list of addresses.

subject ​

Type: String

Required: Yes

The subject line of the email.

msg ​

Type: String

Required: Yes

The plain text body of the email.

options ​

Type: Object

Required: No

Optional settings for the email. Can include:

  • ccAddr: String | Array of Strings
  • bccAddr: String | Array of Strings
  • sendAt: Number (scheduled send, in Unix timestamp seconds)

Output ​

Type: Promise

Resolves to an object: