کسٹمر Sync
کسٹمر Sync
اپنے ای کامرس پلیٹ فارم سے کسٹمر ڈیٹا کو Brevo contacts کے ساتھ خودکار طور پر synchronize کریں۔ یہ skill یقینی بناتی ہے کہ آپ کی Brevo contact فہرست ہمیشہ آپ کے موجودہ کسٹمر بیس کی عکاسی کرے۔
جائزہ
| خاصیت | ویلیو |
|---|---|
| زمرہ | Data Sync |
| حیثیت | Stable |
| ورژن | 2.1 |
| Triggers | customer_created, customer_updated, customer_deleted |
| Actions | Create Contact، Update Contact، Delete Contact |
یہ کیسے کام کرتا ہے
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]- ایونٹ کا پتہ لگانا: آپ کے پلیٹ فارم سے کسٹمر لائف سائیکل ایونٹس کو سنتا ہے
- ڈیٹا Mapping: پلیٹ فارم کے فیلڈز کو Brevo contact attributes پر map کرتا ہے
- API Sync: Brevo API کے ذریعے contacts بناتا، اپ ڈیٹ یا ڈیلیٹ کرتا ہے
- Error ہینڈلنگ: ناکام آپریشنز کو exponential backoff کے ساتھ retry کرتا ہے
کنفیگریشن
بنیادی سیٹ اپ
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
اپنے پلیٹ فارم کے کسٹمر فیلڈز کو Brevo contact attributes پر map کریں:
ڈیفالٹ Field Mappings
| Parameter | Type | Description |
|---|---|---|
email required | string | کسٹمر کا ای میل ایڈریس۔ Brevo میں unique identifier کے طور پر استعمال ہوتا ہے۔ |
firstName optional | string | کسٹمر کا پہلا نام۔ FIRSTNAME attribute پر map ہوتا ہے۔ |
lastName optional | string | کسٹمر کا آخری نام۔ LASTNAME attribute پر map ہوتا ہے۔ |
phone optional | string | E.164 فارمیٹ میں فون نمبر۔ WhatsApp/SMS کے لیے SMS attribute پر map ہوتا ہے۔ |
acceptsMarketing optional | boolean | مارکیٹنگ opt-in حیثیت۔ ای میل سبسکرپشن کی حیثیت کو کنٹرول کرتی ہے۔ |
Custom Attributes
ای کامرس ڈیٹا کے لیے custom attribute mappings شامل کریں:
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
پہلے attributes بنائیں: Custom attributes کو sync کرنے سے پہلے Brevo میں بنانا ضروری ہے۔ انہیں بنانے کے لیے Brevo ڈیش بورڈ یا API استعمال کریں۔
Triggers
customer_created
اس وقت فائر ہوتا ہے جب آپ کے پلیٹ فارم میں نیا کسٹمر بنتا ہے۔
{ "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
اس وقت فائر ہوتا ہے جب کسٹمر کی معلومات میں ترمیم ہوتی ہے۔
{ "event": "customer_updated", "timestamp": "2024-01-15T14:45:00Z", "data": { "id": "cust_12345", "changes": { "phone": { "old": null, "new": "+1234567890" } } }}customer_deleted
اس وقت فائر ہوتا ہے جب آپ کے پلیٹ فارم سے کسٹمر ہٹایا جاتا ہے۔
{ "event": "customer_deleted", "timestamp": "2024-01-15T16:00:00Z", "data": { "id": "cust_12345", "deletedAt": "2024-01-15T16:00:00Z" }}Actions
Create Contact
جب کوئی کسٹمر بنتا ہے تو Brevo میں نیا contact بناتا ہے۔
/v3/contacts اپنے Brevo اکاؤنٹ میں نیا contact بنائیں
Query Parameters
| Parameter | Description |
|---|---|
| email string required | Contact ای میل ایڈریس |
| attributes object optional | Contact attributes |
| listIds array optional | List IDs جن میں contact شامل کرنا ہے |
| updateEnabled boolean optional | اگر contact موجود ہو تو اپ ڈیٹ کریں
Default: false |
Responses
Update Contact
کسٹمر ڈیٹا تبدیل ہونے پر موجودہ contact کو اپ ڈیٹ کرتا ہے۔
/v3/contacts/{identifier} موجودہ contact کے attributes اپ ڈیٹ کریں
Path Parameters
| Parameter | Description |
|---|---|
| identifier string required | ای میل یا contact ID |
Query Parameters
| Parameter | Description |
|---|---|
| attributes object optional | اپ ڈیٹ کرنے والے attributes |
| listIds array optional | Lists جن میں contact شامل کرنا ہے |
| unlinkListIds array optional | Lists جن سے contact ہٹانا ہے |
Responses
Delete Contact
کسٹمر ڈیلیٹ ہونے پر contact کو ہٹاتا ہے۔
/v3/contacts/{identifier} Brevo سے contact کو مستقل طور پر حذف کریں
Path Parameters
| Parameter | Description |
|---|---|
| identifier string required | ای میل یا contact ID |
Responses
کوڈ کی مثالیں
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 }})مانیٹرنگ
Sync حیثیت کا ڈیش بورڈ
Tajo ڈیش بورڈ میں sync کی کارکردگی کی نگرانی کریں:
- Sync کامیابی کی شرح: کامیاب syncs کا فیصد
- اوسط Latency: ایونٹ سے Brevo اپ ڈیٹ تک کا وقت
- Error شرح: ناکام sync کی کوششیں
- قطار کی گہرائی: زیر التوا sync آپریشنز
Webhook نوٹیفیکیشنز
Sync ایونٹس کے لیے نوٹیفیکیشنز وصول کریں:
notifications: webhook_url: https://your-app.com/webhooks/tajo events: - sync_completed - sync_failed - batch_completedمسائل کا حل
عام مسائل
Contact پہلے سے موجود ہے (409)
موجودہ contacts کو ناکام ہونے کے بجائے اپ ڈیٹ کرنے کے لیے اپنی کنفیگریشن میں updateEnabled: true فعال کریں۔
| Error | وجہ | حل |
|---|---|---|
Contact already exists | اس ای میل کے ساتھ contact موجود ہے | updateEnabled: true فعال کریں |
Invalid attribute | Attribute Brevo میں موجود نہیں ہے | پہلے Brevo میں attribute بنائیں |
Rate limit exceeded | بہت زیادہ API درخواستیں | Batch sync موڈ استعمال کریں |
Invalid email format | غلط ای میل ایڈریس | Sync سے پہلے ای میلز کی توثیق کریں |
Debug موڈ
مسائل کے حل کے لیے debug لاگنگ فعال کریں:
skills: customer-sync: debug: true log_level: verboseمتعلقہ Skills
- Order Events - آرڈر ڈیٹا sync کریں
- Product Catalog - پروڈکٹ ڈیٹا sync کریں
- Cart Events - Cart کی سرگرمی ٹریک کریں
اگلے اقدامات
- اپنے پلیٹ فارم کے لیے field mappings کنفیگر کریں
- Brevo میں custom attributes سیٹ اپ کریں
- فوری اپ ڈیٹس کے لیے حقیقی وقت sync فعال کریں