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
| Eigenschap | Waarde |
|---|---|
| Platform | SendGrid (Twilio) |
| Categorie | Marketing |
| Setupcomplexiteit | Eenvoudig |
| Officiële integratie | Ja |
| Gesynchroniseerde data | Contacten, Campaigns, Transactionele e-mail, Events |
| API Base URL | https://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:
- Een SendGrid-account (Free, Essentials, Pro of Premier)
- Een SendGrid API key met de vereiste rechten
- Een Brevo-account met API-toegang
- Een Tajo-account
Authenticatie
API Key-authenticatie
SendGrid gebruikt bearer token-authenticatie.
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 AccessSuppressions: Read AccessTracking: Read AccessAPI 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": 62Veldmapping
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_TYPEAPI-endpoints
Marketing-contacten
| Method | Endpoint | Beschrijving |
|---|---|---|
PUT | /v3/marketing/contacts | Contacten toevoegen of bijwerken |
POST | /v3/marketing/contacts/search | Contacten zoeken |
GET | /v3/marketing/contacts/count | Aantal contacten ophalen |
POST | /v3/marketing/contacts/exports | Contacten exporteren |
DELETE | /v3/marketing/contacts | Contacten verwijderen |
GET | /v3/marketing/lists | Alle contactlijsten opvragen |
Transactionele e-mail (Mail Send)
| Method | Endpoint | Beschrijving |
|---|---|---|
POST | /v3/mail/send | Een e-mail versturen |
GET | /v3/templates | Dynamic Templates opvragen |
GET | /v3/templates/{id} | Templatedetails ophalen |
Campaigns (Single Sends)
| Method | Endpoint | Beschrijving |
|---|---|---|
GET | /v3/marketing/singlesends | Single Sends opvragen |
GET | /v3/marketing/singlesends/{id} | Single Send-details ophalen |
GET | /v3/marketing/automations | Automations opvragen |
Statistieken
| Method | Endpoint | Beschrijving |
|---|---|---|
GET | /v3/stats | Globale e-mailstatistieken ophalen |
GET | /v3/categories/stats | Categoriestatistieken ophalen |
GET | /v3/marketing/stats/singlesends | Single Send-stats ophalen |
Suppressions
| Method | Endpoint | Beschrijving |
|---|---|---|
GET | /v3/suppression/bounces | Gebouncede e-mails opvragen |
GET | /v3/suppression/blocks | Geblokkeerde e-mails opvragen |
GET | /v3/suppression/spam_reports | Spam reports opvragen |
GET | /v3/suppression/unsubscribes | Globale unsubscribes opvragen |
Events
E-mailevents (via Event Webhook)
| Event | Trigger | Use case |
|---|---|---|
processed | E-mail geaccepteerd door SendGrid | Bevestiging versturen |
delivered | E-mail bezorgd bij ontvanger | Delivery-tracking |
open | E-mail geopend | Engagement-scoring |
click | Link geklikt | Interesse-tracking |
bounce | E-mail gebounced | Listhygiëne |
dropped | E-mail onderdrukt | Compliance-review |
deferred | Levering uitgesteld | Retry-monitoring |
spam_report | Gemarkeerd als spam | Reputatiebeheer |
unsubscribe | Uitgeschreven via link | Voorkeursynchronisatie |
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 SendGridawait tajo.connectors.connect('sendgrid', { apiKey: process.env.SENDGRID_API_KEY});Contacten migreren naar Brevo
// Full contact migration from SendGrid to Brevoawait tajo.connectors.sync('sendgrid', { type: 'full', resources: ['contacts', 'suppressions'], options: { includeCustomFields: true, migrateListMemberships: true, migrateSuppressions: true }});
// Check migration statusconst 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 Webhookapp.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:
| Endpoint | Limiet | Details |
|---|---|---|
Mail Send (/v3/mail/send) | Plan-afhankelijk | Free: 100/dag, Essentials: op basis van plan |
| Marketing Contacts PUT | 3 requests/seconde | Batch tot 30.000 contacten |
| Marketing Contacts Search | 50 requests/seconde | Per API key |
| Algemene API | 1.000 requests/seconde | Per API key |
| Event Webhook | Batch-delivery | Tot 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
| Probleem | Oorzaak | Oplossing |
|---|---|---|
| 401 Unauthorized | Ongeldige API key | Verifieer API key in SendGrid Settings |
| 403 Forbidden | Onvoldoende API key-rechten | Maak nieuwe key met vereiste scopes |
| Contact-export pending | Verwerking grote dataset | Poll het export status-endpoint tot voltooid |
| Suppression-sync onvolledig | Paginering vereist | Implementeer paginering met offset-parameter |
| Event-webhook niet ontvangen | URL niet geverifieerd | Voltooi webhook URL-verificatie in SendGrid |
Debugmodus
Schakel uitgebreide logging in:
connectors: sendgrid: debug: true log_level: verbose log_webhooks: trueVerbinding testen
tajo connectors test sendgrid# ✓ API connection successful# ✓ Contacts readable# ✓ Lists accessible# ✓ Statistics readable# ✓ Suppressions accessibleBest practices
- Migreer suppressions als eerste - Zorg dat bounces, blocks en unsubscribes in Brevo staan voordat je verstuurt
- Gebruik batch contact-uploads - PUT tot 30.000 contacten per request voor efficiëntie
- Verifieer Event Webhook - Schakel signed webhooks in met ECDSA-verificatie
- Map custom fields - Maak overeenkomstige Brevo-attributen aan vóór contactmigratie
- Synchroniseer engagementdata - Importeer historische stats voor segmentatie in Brevo
- 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