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

PropertyValue
CategoryData Sync
StatusStable
Version2.1
Triggerscustomer_created, customer_updated, customer_deleted
ActionsCreate 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]
  1. Event Detection: Listens for customer lifecycle events from your platform
  2. Data Mapping: Maps platform fields to Brevo contact attributes
  3. API Sync: Creates, updates, or deletes contacts via Brevo API
  4. 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 list

Field 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.

Default: FIRSTNAME
lastName optional
string

Customer's last name. Maps to LASTNAME attribute.

Default: LASTNAME
phone optional
string

Phone number in E.164 format. Maps to SMS attribute for WhatsApp/SMS.

Default: SMS
acceptsMarketing optional
boolean

Marketing opt-in status. Controls email subscription status.

Default: true

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

Tip

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",
"email": "[email protected]",
"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",
"email": "[email protected]",
"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",
"email": "[email protected]",
"deletedAt": "2024-01-15T16:00:00Z"
}
}

Actions

Create Contact

Creates a new contact in Brevo when a customer is created.

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

201 Contact created successfully
400 Invalid request parameters
409 Contact already exists

Update Contact

Updates an existing contact when customer data changes.

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

204 Contact updated successfully
400 Invalid request parameters
404 Contact not found

Delete Contact

Removes a contact when a customer is deleted.

DELETE /v3/contacts/{identifier}

Permanently delete a contact from Brevo

Path Parameters

Parameter Description
identifier string required
Email or contact ID

Responses

204 Contact deleted successfully
404 Contact not found

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 skill
await 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 sync
await 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 skill
tajo.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 sync
tajo.skills.trigger('customer-sync', {
'event': 'customer_updated',
'data': {
'email': '[email protected]',
'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_completed

Troubleshooting

Common Issues

Contact Already Exists (409)

Enable updateEnabled: true in your configuration to update existing contacts instead of failing.

ErrorCauseSolution
Contact already existsContact with email existsEnable updateEnabled: true
Invalid attributeAttribute doesn’t exist in BrevoCreate attribute in Brevo first
Rate limit exceededToo many API requestsUse batch sync mode
Invalid email formatMalformed email addressValidate emails before sync

Debug Mode

Enable debug logging for troubleshooting:

skills:
customer-sync:
debug: true
log_level: verbose

Next Steps

  1. Configure field mappings for your platform
  2. Set up custom attributes in Brevo
  3. Enable real-time sync for instant updates
AI 助手

你好!关于文档有任何问题都可以问我。

免费开始使用Brevo