SendGrid

Introduction

SendGrid is a powerful email delivery platform that allows users to send both transactional and marketing emails. The integration of SendGrid with Locale enables users to automate email sending processes, including the use of dynamic templates for personalized communication.

Integration

To use SendGrid in your Locale workflows, you'll need to set up the integration by obtaining an API key from your SendGrid account.

Obtaining the API Key

Follow these steps to create an API key in SendGrid:

  1. Navigate to Settings on the left navigation bar, and then select API Keys.
  2. Click Create API Key.
  3. Give your API key a name.
  4. Select Full Access, Restricted Access, or Billing Access.
  5. If you're selecting Restricted Access or Billing Access, select the specific permissions to give each category. For more information, see API key permissions.
  6. Click Create & View.
  7. Copy your API key and store it securely. For security reasons, do not put it directly in your code or commit it somewhere public like GitHub.

Connecting SendGrid to Locale

  1. In Locale, navigate to the Integrations section.
  2. Find and select SendGrid from the list of available integrations.
  3. Enter the API key you obtained from SendGrid when prompted.
  4. Complete any additional authentication steps if required.

Once connected, you'll be able to use SendGrid actions in your Locale workflows.

Actions

SendGrid integration in Locale offers two primary actions for sending emails:

1. Send Email

This action allows users to send a standard email with custom content.

Configuration:

  • From: Email address of the sender
  • From Name: Name of the sender
  • To: Recipient's email address
  • Reply To: Email address for replies
  • Subject: Subject line of the email
  • Content: Body of the email (can be plain text or HTML)

2. Send Template Email

This action enables users to send emails using pre-designed SendGrid templates with dynamic content.

Configuration:

  • From: Email address of the sender
  • From Name: Name of the sender
  • To: Recipient's email address
  • Reply To: Email address for replies
  • Template ID: ID of the SendGrid template to use
  • Dynamic Data: JSON object containing dynamic variables to be used within the template

Example of Dynamic Data:

{
  "total": "$ 239.85",
  "items": [
    {
      "text": "New Line Sneakers",
      "image": "https://example.com/image1.png",
      "price": "$ 79.95"
    },
    {
      "text": "Old Line Sneakers",
      "image": "https://example.com/image2.png",
      "price": "$ 79.95"
    },
    {
      "text": "Blue Line Sneakers",
      "image": "https://example.com/image3.png",
      "price": "$ 79.95"
    }
  ],
  "receipt": true,
  "name": "Sample Name",
  "address01": "1234 Fake St.",
  "address02": "Apt. 123",
  "city": "Place",
  "state": "CO",
  "zip": "80202"
}

Users can incorporate Locale's data variables within the dynamic data variables. For more detailed information on using dynamic templates, refer to the SendGrid documentation.

Using SendGrid in Your Workflows

Example Workflow: Sending a Welcome Email

  1. Trigger: New user signs up (e.g., from a database or API)
  2. Action: Send Template Email
    • From: welcome@yourcompany.com
    • From Name: Your Company
    • To:
    • Template ID: d-xxxxxxxxxxxx
    • Dynamic Data:
      {
        "first_name": "{{ newUser.firstName }}",
        "company_name": "Your Company",
        "help_email": "support@yourcompany.com"
      }
      

Best Practices

  1. Use SendGrid templates for consistent email design and easy maintenance.
  2. Leverage dynamic data to personalize emails for each recipient.
  3. Test your emails thoroughly before sending them to customers.
  4. Monitor your SendGrid dashboard for email performance metrics.
  5. Ensure compliance with email regulations like CAN-SPAM and GDPR.

The SendGrid integration in Locale provides a robust solution for automating email communications within your workflows. Whether you're sending simple transactional emails or complex, dynamically-populated marketing messages, SendGrid and Locale work together to streamline your email processes and enhance your communication strategies.