Custom Integrations
Build your own integrations using our API.
Integration SDK
Install the SDK:
npm install @irresistible/sdk
Basic Usage
import { IrresistibleSDK } from '@irresistible/sdk';
const sdk = new IrresistibleSDK({
apiKey: 'your-api-key'
});
// Deploy a project
await sdk.projects.deploy('project-id');
// Get deployment status
const status = await sdk.deployments.get('deployment-id');
Building Custom Integrations
1. Authentication
Use API keys or OAuth:
// API Key
const sdk = new IrresistibleSDK({ apiKey: 'key' });
// OAuth
const sdk = new IrresistibleSDK({
clientId: 'id',
clientSecret: 'secret'
});
2. Event Handling
Listen for events:
sdk.on('deployment.completed', (event) => {
console.log('Deployment completed:', event);
});
3. Custom Actions
Create custom workflows:
async function customDeploy(projectId) {
// Pre-deploy checks
await runTests();
// Deploy
const deployment = await sdk.projects.deploy(projectId);
// Post-deploy actions
await notifyTeam(deployment);
return deployment;
}
Integration Examples
Automated Testing
Run tests before deployment:
sdk.hooks.beforeDeploy(async (context) => {
const testResults = await runTests();
if (!testResults.passed) {
throw new Error('Tests failed');
}
});
Custom Notifications
Send custom notifications:
sdk.on('deployment.completed', async (event) => {
await sendEmail({
to: 'team@company.com',
subject: `Deployment completed: ${event.project.name}`,
body: `Version ${event.version} is now live!`
});
});
Monitoring Integration
Track custom metrics:
sdk.on('deployment.completed', async (event) => {
await metrics.track('deployment', {
project: event.project.id,
duration: event.duration,
status: event.status
});
});
API Reference
Full API documentation at https://docs.irresistible.dev/api