Customer Sync
Customer Sync
Automatically synchronize customer data from your e-commerce platform to Brevo contacts. This skill ensures your Brevo contact list always reflects your current customer base.
Overview
| Property | Value |
|---|---|
| Category | Data Sync |
| Status | Stable |
| Version | 2.1 |
| Triggers | customer_created, customer_updated, customer_deleted |
| Actions | Create Contact, Update Contact, Delete Contact |
How It Works
graph LR A[E-commerce Platform] -->|Customer Event| B[Customer Sync Skill] B -->|Map Data| C[Field Mapping] C -->|API Call| D[Brevo Contacts API] D -->|Success| E[Contact Updated] D -->|Error| F[Retry Queue]- Event Detection: Listens for customer lifecycle events from your platform
- Data Mapping: Maps platform fields to Brevo contact attributes
- API Sync: Creates, updates, or deletes contacts via Brevo API
- Error Handling: Retries failed operations with exponential backoff
Configuration
Basic Setup
skills: customer-sync: enabled: true source: shopify # or woocommerce, magento, custom
# Map platform fields to Brevo attributes field_mapping: email: email firstName: FIRSTNAME lastName: LASTNAME phone: SMS
# Sync options options: sync_mode: realtime # or batch delete_behavior: soft # or hard list_id: 5 # Add to this listField Mapping
Map your platform’s customer fields to Brevo contact attributes:
Default Field Mappings
| Parameter | Type | Description |
|---|---|---|
email required | string | Customer email address. Used as the unique identifier in Brevo. |
firstName optional | string | Customer's first name. Maps to FIRSTNAME attribute. |
lastName optional | string | Customer's last name. Maps to LASTNAME attribute. |
phone optional | string | Phone number in E.164 format. Maps to SMS attribute for WhatsApp/SMS. |
acceptsMarketing optional | boolean | Marketing opt-in status. Controls email subscription status. |
Custom Attributes
Add custom attribute mappings for e-commerce data:
field_mapping: # Standard fields email: email firstName: FIRSTNAME
# Custom e-commerce attributes totalOrders: TOTAL_ORDERS totalSpent: TOTAL_SPENT lastOrderDate: LAST_ORDER_DATE customerTier: CUSTOMER_TIER tags: TAGSTip
Create attributes first: Custom attributes must be created in Brevo before they can be synced. Use the Brevo dashboard or API to create them.
Triggers
customer_created
Fires when a new customer is created in your platform.
{ "event": "customer_created", "timestamp": "2024-01-15T10:30:00Z", "data": { "id": "cust_12345", "firstName": "Jane", "lastName": "Smith", "phone": "+1234567890", "acceptsMarketing": true, "createdAt": "2024-01-15T10:30:00Z" }}customer_updated
Fires when customer information is modified.
{ "event": "customer_updated", "timestamp": "2024-01-15T14:45:00Z", "data": { "id": "cust_12345", "changes": { "phone": { "old": null, "new": "+1234567890" } } }}customer_deleted
Fires when a customer is removed from your platform.
{ "event": "customer_deleted", "timestamp": "2024-01-15T16:00:00Z", "data": { "id": "cust_12345", "deletedAt": "2024-01-15T16:00:00Z" }}Actions
Create Contact
Creates a new contact in Brevo when a customer is created.
/v3/contacts Create a new contact in your Brevo account
Query Parameters
| Parameter | Description |
|---|---|
| email string required | Contact email address |
| attributes object optional | Contact attributes |
| listIds array optional | List IDs to add contact to |
| updateEnabled boolean optional | Update if contact exists
Default: false |
Responses
Update Contact
Updates an existing contact when customer data changes.
/v3/contacts/{identifier} Update an existing contact's attributes
Path Parameters
| Parameter | Description |
|---|---|
| identifier string required | Email or contact ID |
Query Parameters
| Parameter | Description |
|---|---|
| attributes object optional | Attributes to update |
| listIds array optional | Lists to add contact to |
| unlinkListIds array optional | Lists to remove contact from |
Responses
Delete Contact
Removes a contact when a customer is deleted.
/v3/contacts/{identifier} Permanently delete a contact from Brevo
Path Parameters
| Parameter | Description |
|---|---|
| identifier string required | Email or contact ID |
Responses
Code Examples
JavaScript (Node.js)
import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({ apiKey: process.env.TAJO_API_KEY, brevoApiKey: process.env.BREVO_API_KEY});
// Enable customer sync skillawait tajo.skills.enable('customer-sync', { source: 'shopify', fieldMapping: { email: 'email', firstName: 'FIRSTNAME', lastName: 'LASTNAME', totalOrders: 'TOTAL_ORDERS', totalSpent: 'TOTAL_SPENT' }, options: { syncMode: 'realtime', listId: 5 }});
// Manually trigger a syncawait tajo.skills.trigger('customer-sync', { event: 'customer_created', data: { firstName: 'Jane', lastName: 'Smith' }});Python
from tajo import TajoClient
tajo = TajoClient( api_key=os.environ['TAJO_API_KEY'], brevo_api_key=os.environ['BREVO_API_KEY'])
# Enable customer sync skilltajo.skills.enable('customer-sync', { 'source': 'woocommerce', 'field_mapping': { 'email': 'email', 'first_name': 'FIRSTNAME', 'last_name': 'LASTNAME', 'total_orders': 'TOTAL_ORDERS' }, 'options': { 'sync_mode': 'realtime', 'list_id': 5 }})
# Manually trigger a synctajo.skills.trigger('customer-sync', { 'event': 'customer_updated', 'data': { 'total_orders': 10, 'total_spent': 1250.00 }})Monitoring
Sync Status Dashboard
Monitor sync performance in the Tajo dashboard:
- Sync Success Rate: Percentage of successful syncs
- Average Latency: Time from event to Brevo update
- Error Rate: Failed sync attempts
- Queue Depth: Pending sync operations
Webhook Notifications
Receive notifications for sync events:
notifications: webhook_url: https://your-app.com/webhooks/tajo events: - sync_completed - sync_failed - batch_completedTroubleshooting
Common Issues
Contact Already Exists (409)
Enable updateEnabled: true in your configuration to update existing contacts instead of failing.
| Error | Cause | Solution |
|---|---|---|
Contact already exists | Contact with email exists | Enable updateEnabled: true |
Invalid attribute | Attribute doesn’t exist in Brevo | Create attribute in Brevo first |
Rate limit exceeded | Too many API requests | Use batch sync mode |
Invalid email format | Malformed email address | Validate emails before sync |
Debug Mode
Enable debug logging for troubleshooting:
skills: customer-sync: debug: true log_level: verboseRelated Skills
- Order Events - Sync order data
- Product Catalog - Sync product data
- Cart Events - Track cart activity
Next Steps
- Configure field mappings for your platform
- Set up custom attributes in Brevo
- Enable real-time sync for instant updates