API Integrations
Extend the power of Bulk Product Editor by integrating with external systems, automating workflows, and synchronizing data across your entire business ecosystem.
Overview
Integration Capabilities
Supported Systems
- ERP Systems (SAP, Oracle, NetSuite)
- Inventory Management (TradeGecko, Cin7, Zoho)
- Analytics Platforms (Google Analytics, Klaviyo)
- Marketing Tools (Mailchimp, HubSpot, Salesforce)
- Accounting Software (QuickBooks, Xero, FreshBooks)
- Warehouse Management (ShipStation, Fulfillment by Amazon)
Integration Types
- Real-time Sync: Instant data synchronization
- Scheduled Sync: Automated periodic updates
- Event-driven: Triggered by specific actions
- Manual Sync: On-demand data exchange
API Authentication
Setup Process
API Key Generation
- Navigate to Settings → API Integrations
- Click "Generate New API Key"
- Set permissions and scope
- Copy and securely store the key
- Configure webhook endpoints (optional)
Authentication Methods
API Key Authentication:
Header: X-API-Key: your_api_key_here
OAuth 2.0:
Header: Authorization: Bearer your_access_token
Webhook Verification:
Header: X-Webhook-Signature: signature_hash
Security Best Practices
API Key Management
- Store keys in secure environment variables
- Rotate keys regularly (every 90 days)
- Use different keys for different environments
- Monitor API key usage and access logs
Access Control
Permissions:
- read:products (View product data)
- write:products (Modify product data)
- read:inventory (View inventory levels)
- write:inventory (Update inventory)
- read:analytics (Access performance data)
- admin:all (Full administrative access)
Common Integrations
ERP System Integration
SAP Integration
{
"integration": "sap",
"endpoint": "https://your-sap-instance.com/api",
"sync_fields": [
"sku",
"cost",
"inventory_quantity",
"vendor",
"category"
],
"sync_frequency": "hourly",
"direction": "bidirectional"
}
NetSuite Integration
{
"integration": "netsuite",
"account_id": "your_account_id",
"consumer_key": "your_consumer_key",
"sync_fields": [
"item_id",
"cost",
"list_price",
"inventory_available",
"location"
],
"batch_size": 100
}
Inventory Management
Real-time Inventory Sync
// Webhook endpoint for inventory updates
app.post('/webhook/inventory-update', (req, res) => {
const { sku, quantity, location } = req.body;
// Update Shopify inventory
updateShopifyInventory(sku, quantity, location);
// Trigger bulk editor sync
triggerBulkEditorSync({
filter: { sku: sku },
update: { inventory_quantity: quantity }
});
res.status(200).send('OK');
});
Multi-location Inventory
{
"locations": [
{
"id": "warehouse_1",
"name": "Main Warehouse",
"sync_enabled": true
},
{
"id": "store_front",
"name": "Retail Store",
"sync_enabled": true
}
],
"sync_rules": {
"total_inventory": "sum_all_locations",
"available_inventory": "exclude_reserved"
}
}
Analytics Integration
Google Analytics Integration
// Sync product performance data
const syncAnalyticsData = async () => {
const analyticsData = await getGoogleAnalyticsData({
metrics: ['sessions', 'pageviews', 'conversions'],
dimensions: ['productSku'],
dateRange: 'last30Days'
});
// Update products with performance data
await bulkUpdateProducts(analyticsData.map(item => ({
sku: item.productSku,
custom_fields: {
sessions_30d: item.sessions,
pageviews_30d: item.pageviews,
conversions_30d: item.conversions
}
})));
};
Klaviyo Integration
{
"integration": "klaviyo",
"api_key": "your_klaviyo_api_key",
"sync_events": [
"product_viewed",
"product_purchased",
"cart_abandoned"
],
"custom_properties": [
"email_engagement_score",
"customer_lifetime_value",
"purchase_frequency"
]
}
Custom API Endpoints
Product Data API
Get Products
GET /api/v1/products
Authorization: Bearer your_access_token
Query Parameters:
- limit: Number of products (max 250)
- page: Page number
- filter: JSON filter object
- fields: Comma-separated field list
Update Products
PUT /api/v1/products/bulk
Authorization: Bearer your_access_token
Content-Type: application/json
{
"products": [
{
"id": "product_id_1",
"price": 29.99,
"inventory_quantity": 100
},
{
"id": "product_id_2",
"tags": ["sale", "featured"]
}
]
}
Bulk Operations API
Create Bulk Job
POST /api/v1/bulk-jobs
Authorization: Bearer your_access_token
{
"operation": "update",
"filter": {
"product_type": "T-Shirt",
"vendor": "Premium Brand"
},
"updates": {
"tags": ["summer-sale"],
"price_adjustment": {
"type": "percentage",
"value": -20
}
},
"schedule": "2024-06-01T00:00:00Z"
}
Monitor Job Status
GET /api/v1/bulk-jobs/{job_id}
Authorization: Bearer your_access_token
Response:
{
"id": "job_123",
"status": "completed",
"progress": 100,
"total_products": 150,
"processed_products": 150,
"errors": 0,
"started_at": "2024-06-01T00:00:00Z",
"completed_at": "2024-06-01T00:05:30Z"
}
Webhook Configuration
Setting Up Webhooks
Webhook Events
{
"events": [
"product.created",
"product.updated",
"product.deleted",
"bulk_job.started",
"bulk_job.completed",
"bulk_job.failed",
"inventory.updated"
],
"endpoint": "https://your-app.com/webhooks/bulk-editor",
"secret": "your_webhook_secret"
}
Webhook Payload Example
{
"event": "bulk_job.completed",
"timestamp": "2024-06-01T00:05:30Z",
"data": {
"job_id": "job_123",
"operation": "update",
"total_products": 150,
"successful_updates": 148,
"failed_updates": 2,
"execution_time": "5.5 seconds"
}
}
Webhook Security
Signature Verification
const crypto = require('crypto');
function verifyWebhookSignature(payload, signature, secret) {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expectedSignature)
);
}
Automation Workflows
Workflow Examples
Price Synchronization
name: "ERP Price Sync"
trigger: "schedule"
schedule: "0 */6 * * *" # Every 6 hours
steps:
- fetch_erp_prices:
system: "sap"
endpoint: "/api/products/prices"
- filter_products:
criteria:
status: "active"
sync_enabled: true
- update_prices:
source: "erp_prices"
validation: "price_range_check"
- notify:
channel: "slack"
message: "Price sync completed: {updated_count} products"
Inventory Alerts
name: "Low Stock Alert"
trigger: "inventory_change"
conditions:
- inventory_quantity < 10
- status = "active"
- NOT tags.contains("discontinued")
actions:
- send_email:
to: "inventory@company.com"
template: "low_stock_alert"
- create_purchase_order:
system: "erp"
quantity: "reorder_point"
- update_product:
tags: ["low-stock"]
Conditional Logic
Advanced Workflows
// Complex workflow with conditional logic
const workflow = {
name: "Dynamic Pricing",
trigger: "daily",
conditions: [
{
if: "competitor_price < our_price * 0.95",
then: "update_price_to_match",
else: "maintain_current_price"
},
{
if: "inventory_days_supply < 30",
then: "increase_price_by_5_percent"
},
{
if: "sales_velocity > average * 1.5",
then: "increase_price_by_10_percent"
}
]
};
Error Handling
Common Error Scenarios
Rate Limiting
// Handle rate limiting with exponential backoff
const makeAPICall = async (url, data, retries = 3) => {
try {
const response = await fetch(url, {
method: 'POST',
body: JSON.stringify(data),
headers: { 'Content-Type': 'application/json' }
});
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || 60;
await sleep(retryAfter * 1000);
return makeAPICall(url, data, retries - 1);
}
return response.json();
} catch (error) {
if (retries > 0) {
await sleep(Math.pow(2, 3 - retries) * 1000);
return makeAPICall(url, data, retries - 1);
}
throw error;
}
};
Data Validation
// Validate data before API calls
const validateProductData = (product) => {
const errors = [];
if (!product.sku) errors.push('SKU is required');
if (product.price < 0) errors.push('Price must be positive');
if (!product.title || product.title.length < 3) {
errors.push('Title must be at least 3 characters');
}
return errors;
};
Error Recovery
Retry Mechanisms
{
"retry_policy": {
"max_retries": 3,
"backoff_strategy": "exponential",
"base_delay": 1000,
"max_delay": 30000,
"retry_on": [
"network_error",
"timeout",
"rate_limit",
"server_error"
]
}
}
Fallback Strategies
// Fallback to alternative data source
const getProductData = async (sku) => {
try {
return await getPrimarySystemData(sku);
} catch (primaryError) {
console.warn('Primary system failed, trying backup');
try {
return await getBackupSystemData(sku);
} catch (backupError) {
console.error('Both systems failed, using cached data');
return getCachedData(sku);
}
}
};
Monitoring and Logging
Integration Health
Health Checks
// Monitor integration health
const healthCheck = async () => {
const integrations = ['erp', 'analytics', 'inventory'];
const results = {};
for (const integration of integrations) {
try {
const response = await testIntegration(integration);
results[integration] = {
status: 'healthy',
response_time: response.time,
last_sync: response.lastSync
};
} catch (error) {
results[integration] = {
status: 'unhealthy',
error: error.message,
last_successful_sync: getLastSuccessfulSync(integration)
};
}
}
return results;
};
Performance Metrics
{
"metrics": {
"api_calls_per_minute": 45,
"average_response_time": "250ms",
"error_rate": "0.5%",
"sync_success_rate": "99.2%",
"data_freshness": "5 minutes"
}
}
Logging Best Practices
Structured Logging
// Use structured logging for better analysis
logger.info('API integration sync completed', {
integration: 'erp',
products_synced: 1250,
duration: '45 seconds',
errors: 3,
timestamp: new Date().toISOString()
});
Best Practices
Integration Design
- Start Simple: Begin with basic read-only integrations
- Test Thoroughly: Use sandbox environments for testing
- Handle Errors Gracefully: Implement comprehensive error handling
- Monitor Performance: Track API usage and response times
- Document Everything: Maintain clear integration documentation
Data Management
- Validate Data: Always validate data before processing
- Handle Conflicts: Define conflict resolution strategies
- Maintain Consistency: Ensure data consistency across systems
- Backup Regularly: Maintain backups of critical data
- Version Control: Track API and integration changes
Next Steps
Explore advanced integration topics: