SendGrid-connector

Verbind je SendGrid-account met Brevo via Tajo voor migratie van e-mailinfrastructuur, contactsynchronisatie, overdracht van campagnedata en uniforme engagement-analytics op beide platforms.

Overzicht

EigenschapWaarde
PlatformSendGrid (Twilio)
CategorieMarketing
SetupcomplexiteitEenvoudig
Officiële integratieJa
Gesynchroniseerde dataContacten, Campaigns, Transactionele e-mail, Events
API Base URLhttps://api.sendgrid.com/v3

Functies

  • Contactmigratie - Migreer SendGrid Marketing-contacten naar Brevo met custom fields
  • Transactionele e-mailsynchronisatie - Volg transactionele e-mailevents voor uniforme rapportage
  • Campagnedata - Synchroniseer Single Send- en Automation-campagneprestatiedata
  • Event-webhooks - Stuur e-mailevents (delivered, opened, clicked, bounced) door naar Brevo
  • Suppression-synchronisatie - Migreer bounce-, block- en unsubscribelijsten voor compliance
  • Templatemigratie - Exporteer Dynamic Transactional Templates voor gebruik in Brevo
  • Sender-verificatie - Synchroniseer geverifieerde sender-identiteiten en domeinauthenticatie
  • Statistiek-synchronisatie - Importeer historische engagementstatistieken naar Brevo-attributen

Vereisten

Voordat je begint, zorg dat je beschikt over:

  1. Een SendGrid-account (Free, Essentials, Pro of Premier)
  2. Een SendGrid API key met de vereiste rechten
  3. Een Brevo-account met API-toegang
  4. Een Tajo-account

Authenticatie

API Key-authenticatie

SendGrid gebruikt bearer token-authenticatie.

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

Maak API keys aan in SendGrid Settings > API Keys met specifieke rechtenniveaus:

  • Full Access - Volledige API-toegang
  • Restricted Access - Granulaire rechtencontrole
  • Billing Access - Alleen billing-operaties

Vereiste rechten

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

SendGrid API keys worden alleen bij creatie getoond. Bewaar ze veilig. Bij verlies moet je een nieuwe key aanmaken.

Configuratie

Basisinstelling

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

Veldmapping

Map SendGrid-contactvelden naar Brevo-contactattributen:

Standaardmappings

Parameter Type Description
email required
string

E-mailadres van contact (unieke identifier)

first_name optional
string

Mapt naar FIRSTNAME-attribuut

last_name optional
string

Mapt naar LASTNAME-attribuut

phone_number optional
string

Mapt naar SMS-attribuut

city optional
string

Stad van contact

country optional
string

Land van contact

custom_fields optional
object

Custom field-key-value-paren

list_ids optional
array

Lidmaatschappen van SendGrid-lijsten

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

MethodEndpointBeschrijving
PUT/v3/marketing/contactsContacten toevoegen of bijwerken
POST/v3/marketing/contacts/searchContacten zoeken
GET/v3/marketing/contacts/countAantal contacten ophalen
POST/v3/marketing/contacts/exportsContacten exporteren
DELETE/v3/marketing/contactsContacten verwijderen
GET/v3/marketing/listsAlle contactlijsten opvragen

Transactionele e-mail (Mail Send)

MethodEndpointBeschrijving
POST/v3/mail/sendEen e-mail versturen
GET/v3/templatesDynamic Templates opvragen
GET/v3/templates/{id}Templatedetails ophalen

Campaigns (Single Sends)

MethodEndpointBeschrijving
GET/v3/marketing/singlesendsSingle Sends opvragen
GET/v3/marketing/singlesends/{id}Single Send-details ophalen
GET/v3/marketing/automationsAutomations opvragen

Statistieken

MethodEndpointBeschrijving
GET/v3/statsGlobale e-mailstatistieken ophalen
GET/v3/categories/statsCategoriestatistieken ophalen
GET/v3/marketing/stats/singlesendsSingle Send-stats ophalen

Suppressions

MethodEndpointBeschrijving
GET/v3/suppression/bouncesGebouncede e-mails opvragen
GET/v3/suppression/blocksGeblokkeerde e-mails opvragen
GET/v3/suppression/spam_reportsSpam reports opvragen
GET/v3/suppression/unsubscribesGlobale unsubscribes opvragen

Events

E-mailevents (via Event Webhook)

EventTriggerUse case
processedE-mail geaccepteerd door SendGridBevestiging versturen
deliveredE-mail bezorgd bij ontvangerDelivery-tracking
openE-mail geopendEngagement-scoring
clickLink gekliktInteresse-tracking
bounceE-mail gebouncedListhygiëne
droppedE-mail onderdruktCompliance-review
deferredLevering uitgesteldRetry-monitoring
spam_reportGemarkeerd als spamReputatiebeheer
unsubscribeUitgeschreven via linkVoorkeursynchronisatie

Codevoorbeelden

Connector initialiseren

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

Contacten migreren naar 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
// }

E-mailevents doorsturen

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

EndpointLimietDetails
Mail Send (/v3/mail/send)Plan-afhankelijkFree: 100/dag, Essentials: op basis van plan
Marketing Contacts PUT3 requests/secondeBatch tot 30.000 contacten
Marketing Contacts Search50 requests/secondePer API key
Algemene API1.000 requests/secondePer API key
Event WebhookBatch-deliveryTot 1.000 events per POST

Mail Send-limieten

Mail Send-limieten hangen af van je SendGrid-plan. Free-accounts zijn beperkt tot 100 e-mails/dag. Controleer je plandetails voor exacte verzendlimieten.

Probleemoplossing

Veelvoorkomende problemen

ProbleemOorzaakOplossing
401 UnauthorizedOngeldige API keyVerifieer API key in SendGrid Settings
403 ForbiddenOnvoldoende API key-rechtenMaak nieuwe key met vereiste scopes
Contact-export pendingVerwerking grote datasetPoll het export status-endpoint tot voltooid
Suppression-sync onvolledigPaginering vereistImplementeer paginering met offset-parameter
Event-webhook niet ontvangenURL niet geverifieerdVoltooi webhook URL-verificatie in SendGrid

Debugmodus

Schakel uitgebreide logging in:

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

Verbinding testen

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

Best practices

  1. Migreer suppressions als eerste - Zorg dat bounces, blocks en unsubscribes in Brevo staan voordat je verstuurt
  2. Gebruik batch contact-uploads - PUT tot 30.000 contacten per request voor efficiëntie
  3. Verifieer Event Webhook - Schakel signed webhooks in met ECDSA-verificatie
  4. Map custom fields - Maak overeenkomstige Brevo-attributen aan vóór contactmigratie
  5. Synchroniseer engagementdata - Importeer historische stats voor segmentatie in Brevo
  6. Behandel async exports - Contact-exports zijn asynchroon; poll voor voltooiing

Beveiliging

  • API key-authenticatie - Bearer token met granulaire rechtenniveaus
  • Event Webhook-signing - ECDSA-signatureverificatie voor webhook-payloads
  • TLS-encryptie - Alle API-communicatie versleuteld via HTTPS
  • IP Access Management - Beperk Dashboard- en API-toegang op IP
  • Twee-factor-authenticatie - 2FA beschikbaar voor accounttoegang

Gerelateerde bronnen

Subscribe to updates

developer-docs

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

auto-detect
AI-assistent

Hallo! Stel me vragen over de documentatie.