Skip to main content

Custom Integrations

Guide to creating custom integrations with O2VEND.

Overview

Custom integrations allow you to connect O2VEND with external services and systems.

Integration Patterns

1. Webhook Integration

// Webhook handler
app.post('/webhooks/o2vend', async (req, res) => {
const event = req.body;

switch (event.type) {
case 'order.created':
await handleOrderCreated(event.data);
break;
case 'product.updated':
await handleProductUpdated(event.data);
break;
}

res.status(200).send('OK');
});

2. API Integration

// External API integration
async function syncWithExternalService(data) {
const response = await fetch('https://external-api.com/sync', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});

return response.json();
}

3. App-Based Integration

Create an app that handles integration:

{
"id": "external-service-integration",
"name": "External Service Integration",
"hooks": ["order_complete", "product_update"]
}