SendGrid Connector

Connect your SendGrid account to Brevo via Tajo for email infrastructure migration, contact synchronization, campaign data transfer, and unified engagement analytics across both platforms.

Overview

PropertyValue
PlatformSendGrid (Twilio)
CategoryMarketing
Setup ComplexityEasy
Official IntegrationYes
Data SyncedContacts, Campaigns, Transactional Email, Events
API Base URLhttps://api.sendgrid.com/v3

Features

  • Contact migration - Migrate SendGrid Marketing contacts to Brevo with custom fields
  • Transactional email sync - Track transactional email events for unified reporting
  • Campaign data - Sync Single Send and Automation campaign performance data
  • Event webhooks - Forward email events (delivered, opened, clicked, bounced) to Brevo
  • Suppression sync - Migrate bounce, block, and unsubscribe lists for compliance
  • Template migration - Export Dynamic Transactional Templates for Brevo use
  • Sender verification - Sync verified sender identities and domain authentication
  • Statistics sync - Import historical engagement statistics to Brevo attributes

Prerequisites

Before you begin, ensure you have:

  1. A SendGrid account (Free, Essentials, Pro, or Premier)
  2. A SendGrid API key with required permissions
  3. A Brevo account with API access
  4. A Tajo account

Authentication

API Key Authentication

SendGrid uses bearer token authentication.

Terminal window
curl https://api.sendgrid.com/v3/marketing/contacts \
-H "Authorization: Bearer SG.YOUR_API_KEY" \
-H "Content-Type: application/json"

Create API keys in SendGrid Settings > API Keys with specific permission levels:

  • Full Access - Complete API access
  • Restricted Access - Granular permission control
  • Billing Access - Billing-only operations

Required Permissions

Marketing: Full Access
- Contacts (read)
- Single Sends (read)
- Automations (read)
Mail Send: Full Access
- Mail Send (read)
Stats: Read Access
Suppressions: Read Access
Tracking: Read Access

API Key Security

SendGrid API keys are shown only once at creation. Store them securely. If lost, you must create a new key.

Configuration

Basic Setup

connectors:
sendgrid:
enabled: true
api_key: "${SENDGRID_API_KEY}"
# Data sync options
sync:
contacts: true
campaigns: true
transactional: true
suppressions: true
statistics: true
# List mapping to Brevo
list_mapping:
"All Contacts": 60
"Newsletter": 61
"Transactional": 62

Field Mapping

Map SendGrid contact fields to Brevo contact attributes:

Default Mappings

Parameter Type Description
email required
string

Contact email address (unique identifier)

first_name optional
string

Maps to FIRSTNAME attribute

last_name optional
string

Maps to LASTNAME attribute

phone_number optional
string

Maps to SMS attribute

city optional
string

Contact city

country optional
string

Contact country

custom_fields optional
object

Custom field key-value pairs

list_ids optional
array

SendGrid list memberships

Custom Field Mapping

field_mapping:
# Standard fields
email: email
first_name: FIRSTNAME
last_name: LASTNAME
phone_number: SMS
# Location fields
city: CITY
state_province_region: STATE
country: COUNTRY
postal_code: POSTAL_CODE
# Engagement metrics
avg_open_rate: AVG_OPEN_RATE
avg_click_rate: AVG_CLICK_RATE
# Custom fields
custom_fields.company: COMPANY_NAME
custom_fields.plan: PLAN_TYPE

API Endpoints

Marketing Contacts

MethodEndpointDescription
PUT/v3/marketing/contactsAdd or update contacts
POST/v3/marketing/contacts/searchSearch contacts
GET/v3/marketing/contacts/countGet contact count
POST/v3/marketing/contacts/exportsExport contacts
DELETE/v3/marketing/contactsDelete contacts
GET/v3/marketing/listsList all contact lists

Transactional Email (Mail Send)

MethodEndpointDescription
POST/v3/mail/sendSend an email
GET/v3/templatesList Dynamic Templates
GET/v3/templates/{id}Get template details

Campaigns (Single Sends)

MethodEndpointDescription
GET/v3/marketing/singlesendsList Single Sends
GET/v3/marketing/singlesends/{id}Get Single Send details
GET/v3/marketing/automationsList Automations

Statistics

MethodEndpointDescription
GET/v3/statsGet global email statistics
GET/v3/categories/statsGet category statistics
GET/v3/marketing/stats/singlesendsGet Single Send stats

Suppressions

MethodEndpointDescription
GET/v3/suppression/bouncesList bounced emails
GET/v3/suppression/blocksList blocked emails
GET/v3/suppression/spam_reportsList spam reports
GET/v3/suppression/unsubscribesList global unsubscribes

Events

Email Events (via Event Webhook)

EventTriggerUse Case
processedEmail accepted by SendGridSend confirmation
deliveredEmail delivered to recipientDelivery tracking
openEmail openedEngagement scoring
clickLink clickedInterest tracking
bounceEmail bouncedList hygiene
droppedEmail suppressedCompliance review
deferredDelivery deferredRetry monitoring
spam_reportMarked as spamReputation management
unsubscribeUnsubscribed via linkPreference sync

Code Examples

Initialize Connector

import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({
apiKey: process.env.TAJO_API_KEY,
brevoApiKey: process.env.BREVO_API_KEY
});
// Connect SendGrid
await tajo.connectors.connect('sendgrid', {
apiKey: process.env.SENDGRID_API_KEY
});

Migrate Contacts to Brevo

// Full contact migration from SendGrid to Brevo
await tajo.connectors.sync('sendgrid', {
type: 'full',
resources: ['contacts', 'suppressions'],
options: {
includeCustomFields: true,
migrateListMemberships: true,
migrateSuppressions: true
}
});
// Check migration status
const status = await tajo.connectors.status('sendgrid');
console.log(status);
// {
// connected: true,
// lastSync: '2024-01-15T10:30:00Z',
// contactsMigrated: 45000,
// suppressionsSynced: 3200,
// listsMapped: 8
// }

Forward Email Events

// Handle SendGrid Event Webhook
app.post('/webhooks/sendgrid', async (req, res) => {
const signature = req.get('X-Twilio-Email-Event-Webhook-Signature');
// Verify webhook signature (ECDSA)
if (!verifySendGridSignature(req.body, signature)) {
return res.status(401).send('Unauthorized');
}
// Process batch of events
for (const event of req.body) {
await tajo.connectors.handleWebhook('sendgrid', {
type: event.event,
email: event.email,
timestamp: event.timestamp,
payload: event
});
}
res.status(200).send('OK');
});

Rate Limits

SendGrid API rate limits:

EndpointLimitDetails
Mail Send (/v3/mail/send)Plan-dependentFree: 100/day, Essentials: based on plan
Marketing Contacts PUT3 requests/secondBatch up to 30,000 contacts
Marketing Contacts Search50 requests/secondPer API key
General API1,000 requests/secondPer API key
Event WebhookBatch deliveryUp to 1,000 events per POST

Mail Send Limits

Mail Send limits depend on your SendGrid plan. Free accounts are limited to 100 emails/day. Check your plan details for exact sending limits.

Troubleshooting

Common Issues

IssueCauseSolution
401 UnauthorizedInvalid API keyVerify API key in SendGrid Settings
403 ForbiddenInsufficient API key permissionsCreate new key with required scopes
Contact export pendingLarge dataset processingPoll export status endpoint until complete
Suppression sync incompletePagination requiredImplement pagination with offset parameter
Event webhook not receivedURL not verifiedComplete webhook URL verification in SendGrid

Debug Mode

Enable verbose logging:

connectors:
sendgrid:
debug: true
log_level: verbose
log_webhooks: true

Test Connection

Terminal window
tajo connectors test sendgrid
# ✓ API connection successful
# ✓ Contacts readable
# ✓ Lists accessible
# ✓ Statistics readable
# ✓ Suppressions accessible

Best Practices

  1. Migrate suppressions first - Ensure bounces, blocks, and unsubscribes are in Brevo before sending
  2. Use batch contact uploads - PUT up to 30,000 contacts per request for efficiency
  3. Verify Event Webhook - Enable signed webhooks with ECDSA verification
  4. Map custom fields - Create corresponding Brevo attributes before contact migration
  5. Sync engagement data - Import historical stats for segmentation in Brevo
  6. Handle async exports - Contact exports are asynchronous; poll for completion

Security

  • API Key Authentication - Bearer token with granular permission levels
  • Event Webhook signing - ECDSA signature verification for webhook payloads
  • TLS encryption - All API communication encrypted via HTTPS
  • IP Access Management - Restrict Dashboard and API access by IP
  • Two-factor authentication - 2FA available for account access

Open-Source Implementation Map

This section is derived from official or public repository material discovered for the SendGrid connector. Use it as the engineering companion to the setup guide above: it shows where the API surface lives, what implementation assets exist, and how Tajo should translate them into reliable Brevo sync behavior.

Repository Snapshot

RepositoryCommitLanguages / formatsFiles
twilio/sendgrid-oaifb95a93JSON (47), YAML (47), Markdown (5), YAML (1), gitignore (1), license (1)103

Integration Shape

graph LR
Source["SendGrid API / repository"] --> Auth["Auth and scopes"]
Source --> Objects["Objects, events, and schemas"]
Auth --> Tajo["Tajo connector runtime"]
Objects --> Tajo
Tajo --> Brevo["Brevo contacts, attributes, lists, campaigns"]
Tajo --> Ops["Backfill, cursor, retries, logs"]

What To Reuse

  • Sendgrid’s OpenAPI Specification
  • This repository contains OpenAPI documents
  • The SendGrid OAI specifications are automatically generated from the SendGrid OAS specifications using the ‘sendgrid-oas-transpiler’.
  • The ‘sendgrid-oai’ is utilized to auto-generate SendGrid helper libraries through the ‘sendgrid-oai-generator’.
  • Currently, only the ‘sendgrid-java’ helper library is available for auto-generation.

Tajo Revamp Checklist

  • Keep authentication setup aligned with the vendor docs and the public repository’s current API shape.
  • Map primary resources into explicit Tajo sync objects with stable external IDs.
  • Prefer cursor-based or updated-at incremental sync where the API exposes it; otherwise document the fallback.
  • Treat webhook handlers as idempotent and replay-safe, especially for order, contact, ticket, and campaign events.
  • Capture pagination, rate limits, retry headers, and partial-failure behavior in connector smoke tests.
  • Keep examples small and runnable against sandbox or test-mode accounts.

Sources

Subscribe to updates

developer-docs

Drop your email or phone number — we'll send you what matters next.

auto-detect
AI Assistant

Hi! Ask me anything about the docs.