SendGrid Connector

Verbinde dein SendGrid-Konto über Tajo mit Brevo für die Migration deiner E-Mail-Infrastruktur, die Synchronisation von Kontakten, den Transfer von Kampagnendaten und einheitliche Engagement-Analytics über beide Plattformen hinweg.

Überblick

EigenschaftWert
PlattformSendGrid (Twilio)
KategorieMarketing
EinrichtungsaufwandEinfach
Offizielle IntegrationJa
Synchronisierte DatenKontakte, Kampagnen, Transactional-E-Mail, Events
API-Basis-URLhttps://api.sendgrid.com/v3

Funktionen

  • Kontaktmigration - Migriere SendGrid-Marketing-Kontakte inklusive Custom Fields zu Brevo
  • Transactional-E-Mail-Sync - Tracke Transactional-E-Mail-Events für ein einheitliches Reporting
  • Kampagnendaten - Synchronisiere Performance-Daten von Single Sends und Automation-Kampagnen
  • Event-Webhooks - Leite E-Mail-Events (delivered, opened, clicked, bounced) an Brevo weiter
  • Suppression-Sync - Migriere Bounce-, Block- und Unsubscribe-Listen für die Compliance
  • Template-Migration - Exportiere Dynamic Transactional Templates zur Nutzung in Brevo
  • Sender-Verifizierung - Synchronisiere verifizierte Sender Identities und die Domain-Authentifizierung
  • Statistik-Sync - Importiere historische Engagement-Statistiken in Brevo-Attribute

Voraussetzungen

Bevor du beginnst, stelle sicher, dass du Folgendes hast:

  1. Ein SendGrid-Konto (Free, Essentials, Pro oder Premier)
  2. Einen SendGrid-API-Schlüssel mit den erforderlichen Berechtigungen
  3. Ein Brevo-Konto mit API-Zugriff
  4. Ein Tajo-Konto

Authentifizierung

API-Schlüssel-Authentifizierung

SendGrid nutzt eine Bearer-Token-Authentifizierung.

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

Erstelle API-Schlüssel in den SendGrid-Einstellungen unter Settings > API Keys mit bestimmten Berechtigungsstufen:

  • Full Access - Vollständiger API-Zugriff
  • Restricted Access - Granulare Berechtigungssteuerung
  • Billing Access - Ausschließlich Billing-Operationen

Erforderliche Berechtigungen

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

Sicherheit des API-Schlüssels

SendGrid-API-Schlüssel werden nur einmal bei der Erstellung angezeigt. Speichere sie sicher ab. Geht ein Schlüssel verloren, musst du einen neuen Schlüssel anlegen.

Konfiguration

Grundeinrichtung

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

Feldzuordnung

Ordne SendGrid-Kontaktfelder den Brevo-Kontaktattributen zu:

Standardzuordnungen

Parameter Type Description
email required
string

E-Mail-Adresse des Kontakts (eindeutige Kennung)

first_name optional
string

Wird dem FIRSTNAME-Attribut zugeordnet

last_name optional
string

Wird dem LASTNAME-Attribut zugeordnet

phone_number optional
string

Wird dem SMS-Attribut zugeordnet

city optional
string

Stadt des Kontakts

country optional
string

Land des Kontakts

custom_fields optional
object

Key-Value-Paare für Custom Fields

list_ids optional
array

Mitgliedschaften in SendGrid-Listen

Zuordnung benutzerdefinierter Felder

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-Kontakte

MethodeEndpointBeschreibung
PUT/v3/marketing/contactsKontakte hinzufügen oder aktualisieren
POST/v3/marketing/contacts/searchKontakte durchsuchen
GET/v3/marketing/contacts/countAnzahl der Kontakte abrufen
POST/v3/marketing/contacts/exportsKontakte exportieren
DELETE/v3/marketing/contactsKontakte löschen
GET/v3/marketing/listsAlle Kontaktlisten auflisten

Transactional-E-Mail (Mail Send)

MethodeEndpointBeschreibung
POST/v3/mail/sendEine E-Mail versenden
GET/v3/templatesDynamic Templates auflisten
GET/v3/templates/{id}Template-Details abrufen

Kampagnen (Single Sends)

MethodeEndpointBeschreibung
GET/v3/marketing/singlesendsSingle Sends auflisten
GET/v3/marketing/singlesends/{id}Details eines Single Send abrufen
GET/v3/marketing/automationsAutomationen auflisten

Statistiken

MethodeEndpointBeschreibung
GET/v3/statsGlobale E-Mail-Statistiken abrufen
GET/v3/categories/statsStatistiken pro Kategorie abrufen
GET/v3/marketing/stats/singlesendsSingle-Send-Statistiken abrufen

Suppressions

MethodeEndpointBeschreibung
GET/v3/suppression/bouncesGebouncte E-Mails auflisten
GET/v3/suppression/blocksBlockierte E-Mails auflisten
GET/v3/suppression/spam_reportsSpam-Meldungen auflisten
GET/v3/suppression/unsubscribesGlobale Abmeldungen auflisten

Events

E-Mail-Events (über den Event Webhook)

EventAuslöserAnwendungsfall
processedE-Mail von SendGrid angenommenVersandbestätigung
deliveredE-Mail an Empfänger:in zugestelltZustell-Tracking
openE-Mail geöffnetEngagement-Scoring
clickLink angeklicktInteressen-Tracking
bounceE-Mail ist gebouncedListen-Hygiene
droppedE-Mail unterdrücktCompliance-Prüfung
deferredZustellung zurückgestelltRetry-Monitoring
spam_reportAls Spam markiertReputations-Management
unsubscribeAbmeldung über LinkPräferenz-Sync

Code-Beispiele

Connector initialisieren

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
});

Kontakte zu Brevo migrieren

// 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
// }

E-Mail-Events weiterleiten

// 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

Rate Limits der SendGrid-API:

EndpointLimitDetails
Mail Send (/v3/mail/send)Abhängig vom PlanFree: 100/Tag, Essentials: abhängig vom Plan
Marketing Contacts PUT3 Anfragen/SekundeBatch von bis zu 30.000 Kontakten
Marketing Contacts Search50 Anfragen/SekundePro API-Schlüssel
Allgemeine API1.000 Anfragen/SekundePro API-Schlüssel
Event WebhookBatch-ZustellungBis zu 1.000 Events pro POST

Mail-Send-Limits

Die Mail-Send-Limits hängen von deinem SendGrid-Plan ab. Free-Konten sind auf 100 E-Mails pro Tag beschränkt. Prüfe die exakten Versandlimits in deinem Plan.

Fehlerbehebung

Häufige Probleme

ProblemUrsacheLösung
401 UnauthorizedUngültiger API-SchlüsselAPI-Schlüssel in den SendGrid-Einstellungen prüfen
403 ForbiddenUnzureichende API-Schlüssel-BerechtigungenNeuen Schlüssel mit den benötigten Scopes anlegen
Kontakt-Export steht ausVerarbeitung eines großen DatensatzesDen Export-Status-Endpoint abfragen, bis der Export abgeschlossen ist
Suppression-Sync unvollständigPagination erforderlichPagination mit Offset-Parameter umsetzen
Event-Webhook nicht empfangenURL nicht verifiziertVerifizierung der Webhook-URL in SendGrid abschließen

Debug-Modus

Ausführliches Logging aktivieren:

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

Verbindung testen

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

Best Practices

  1. Suppressions zuerst migrieren - Stelle sicher, dass Bounces, Blocks und Unsubscribes in Brevo vorhanden sind, bevor du versendest
  2. Batch-Uploads für Kontakte nutzen - Per PUT bis zu 30.000 Kontakte pro Anfrage übertragen, um effizient zu arbeiten
  3. Event-Webhook verifizieren - Signierte Webhooks mit ECDSA-Verifizierung aktivieren
  4. Custom Fields zuordnen - Lege entsprechende Brevo-Attribute vor der Kontaktmigration an
  5. Engagement-Daten synchronisieren - Importiere historische Stats zur Segmentierung in Brevo
  6. Asynchrone Exporte verarbeiten - Kontakt-Exporte laufen asynchron; Status bis zum Abschluss abfragen

Sicherheit

  • API-Schlüssel-Authentifizierung - Bearer Token mit granularen Berechtigungsstufen
  • Signierung der Event-Webhooks - ECDSA-Signaturprüfung der Webhook-Payloads
  • TLS-Verschlüsselung - Die gesamte API-Kommunikation wird per HTTPS verschlüsselt
  • IP-Zugriffs-Management - Beschränke Dashboard- und API-Zugriff per IP
  • Zwei-Faktor-Authentifizierung - 2FA für den Kontozugriff verfügbar

Verwandte Ressourcen

Subscribe to updates

developer-docs

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

auto-detect
AI-Assistent

Hallo! Fragen Sie mich alles über die Dokumentation.