BigCommerce Integration
E-commerceEnhance product images for BigCommerce stores
BigCommerce API Integration
Product Image Processing Script
// BigCommerce Product Image Enhancer
const BigCommerce = require('node-bigcommerce');
const bigCommerce = new BigCommerce({
clientId: 'YOUR_BC_CLIENT_ID',
accessToken: 'YOUR_BC_ACCESS_TOKEN',
storeHash: 'YOUR_BC_STORE_HASH',
responseType: 'json'
});
async function enhanceProductImages(productId) {
// Get product images
const images = await bigCommerce.get(`/catalog/products/${productId}/images`);
for (const image of images.data) {
// Enhance with ButterflyAPI
const enhanced = await fetch('https://butterflyapi.com/api/v1/run', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_BUTTERFLY_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
api: 'image-enhance',
input: { image_url: image.url_zoom, scale: 2 }
})
}).then(r => r.json());
// Update product image
await bigCommerce.put(`/catalog/products/${productId}/images/${image.id}`, {
image_url: enhanced.output.image_url
});
}
}