How to send email with SendGrid

Knock integrates with SendGrid to send email notifications to your users.

In this guide you'll learn how to get started sending transactional email notifications with SendGrid through Knock. We also cover provider configuration and additional data you can pass through to SendGrid.

Features

  • Attachments support
  • Delivery tracking (only supported for SendGrid accounts with Email Activity)
  • Link and open tracking
  • Per environment configuration
  • Sandbox mode

Getting started

Connect SendGrid to Knock

You can create a new SendGrid channel in the dashboard under the Integrations > Channels section. From there, you'll need to configure the channel for each environment you have.

Here are a few things to note as you configure your SendGrid provider:

  • API key. At a minimum, Knock needs an API key with full access to the Mail Send permission. If you’re looking to support delivery tracking, you’ll need to provide Knock with a SendGrid API key that includes read access to the Email Activity permission. (Note: email activity requires a SendGrid paid add-on.)
  • Check delivery status. If enabled, you can go to the email activity page in SendGrid to check the delivery status of a given email.
  • Enable email open tracking. If enabled, you can go to the email activity page in SendGrid to check the open status of a given email.
  • Enable email link tracking. If enabled, you can go to the email activity page in SendGrid to check the link open status of a given email.

If you choose to enable open and link tracking, please keep user privacy top of mind and follow the privacy guidelines outlined in SendGrid’s documentation.

And that’s it. You’ll see the normal email provider configurations for "from email address" and "from name", as well as any environment defaults you want to send for email recipient fields.

Provider configuration

API keystring*The API key for your SendGrid account
Check delivery statusbooleanWhen set will attempt to check for the delivery status of a message. Only applicable for paid plans.
Open trackingbooleanShould the provider track opens on their service?
Link trackingbooleanShould the provider track link clicks on their service?
From email addressstring | liquid*The sender email address (can use Liquid tags)
From namestring | liquidThe sender name (can use Liquid tags)
JSON overridesstring | liquidProvider API's paramater overrides

Environment default settings

The following fields are optional and if set, will be applied to all email messages sent via this channel within the environment:

Reply-to addressstring | liquidThe reply-to email address (can use Liquid tags)
CC addressstring | liquidThe cc email address (can use Liquid tags)
BCC addressstring | liquidThe bcc email address (can use Liquid tags)

Additional data sent

Knock sends the following attributes along with your emails:

  • custom_args.sender: always set to knock.app
  • custom_args.knock_message_id: the ID of the message this email is associated with
  • tags[0]: the key of the workflow this message was generated from

You can learn about the role of these SendGrid attributes in the SendGrid API documentation.

Recipient data requirements

In order to send an email notification you'll need a valid email property set on your recipient.