Integrations
Connect Irresistible with your favorite tools and services for a seamless development workflow.
Overview
Irresistible integrates with popular development tools and services to enhance your productivity:
- Version Control - GitHub, GitLab, Bitbucket
- Communication - Slack, Discord, Microsoft Teams
- Monitoring - Sentry, LogRocket, DataDog
- Analytics - Google Analytics, Mixpanel, Amplitude
- Payments - Stripe, PayPal, Square
- Authentication - Auth0, Supabase, Firebase
- Databases - PostgreSQL, MySQL, MongoDB
- Email - SendGrid, Mailgun, AWS SES
GitHub Integration
Setup
Connect Repository
irresistible integrations add github
Authorize Access
- Follow the OAuth flow
- Grant repository permissions
- Select repositories to connect
Configure Webhook (automatic)
{ "events": ["push", "pull_request", "issues"], "url": "https://api.irresistible.dev/webhooks/github" }
Features
Automatic Deployments
# .github/workflows/irresistible.yml
name: Deploy to Irresistible
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: irresistible/deploy-action@v1
with:
api-key: ${{ secrets.IRRESISTIBLE_API_KEY }}
environment: production
Pull Request Previews
- Automatic preview deployments
- Comment with preview URL
- Status checks
- Auto-cleanup on merge
Issue Sync
// irresistible.config.js
export default {
integrations: {
github: {
owner: 'username',
repo: 'my-app',
features: {
deployOnPush: true,
prPreviews: true,
issueSync: true,
statusChecks: true
}
}
}
}
GitHub Actions
Custom Workflows
name: Irresistible CI/CD
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: irresistible/setup-action@v1
- run: irresistible test
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: irresistible/deploy-action@v1
with:
api-key: ${{ secrets.IRRESISTIBLE_API_KEY }}
Slack Integration
Setup
Create Slack App
irresistible integrations add slack
Add to Workspace
- Authorize in Slack
- Select channel for notifications
- Configure notification types
Configuration
// irresistible.config.js
export default {
integrations: {
slack: {
webhook: process.env.SLACK_WEBHOOK,
channel: '#deployments',
notifications: {
deployStart: true,
deploySuccess: true,
deployFailure: true,
errorAlerts: true,
performanceAlerts: true
}
}
}
}
Custom Notifications
import { slack } from '@irresistible/integrations';
// Send custom notification
await slack.notify({
text: 'New user signup!',
attachments: [{
color: 'good',
fields: [{
title: 'User',
value: user.email,
short: true
}]
}]
});
Slash Commands
Create custom Slack commands:
// api/slack/commands.js
export async function POST(request) {
const { command, text } = await request.json();
switch (command) {
case '/deploy':
await irresistible.deploy(text);
return { text: `Deploying ${text}...` };
case '/status':
const status = await irresistible.getStatus();
return { text: `Status: ${status}` };
default:
return { text: 'Unknown command' };
}
}
Database Integrations
PostgreSQL
Connection
// irresistible.config.js
export default {
database: {
provider: 'postgresql',
url: process.env.DATABASE_URL,
ssl: true,
poolSize: 10
}
}
Automatic Migrations
# Run migrations on deploy
irresistible db migrate
# Create new migration
irresistible db migration create add_users_table
Database GUI Access your database through the Irresistible dashboard:
- Query editor
- Schema viewer
- Data browser
- Migration history
MongoDB
// irresistible.config.js
export default {
database: {
provider: 'mongodb',
url: process.env.MONGODB_URI,
options: {
useNewUrlParser: true,
useUnifiedTopology: true
}
}
}
Redis
// irresistible.config.js
export default {
cache: {
provider: 'redis',
url: process.env.REDIS_URL,
options: {
ttl: 3600,
maxItems: 1000
}
}
}
Payment Integrations
Stripe
Setup
irresistible integrations add stripe
Configuration
// irresistible.config.js
export default {
integrations: {
stripe: {
secretKey: process.env.STRIPE_SECRET_KEY,
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
features: {
checkout: true,
subscriptions: true,
invoicing: true
}
}
}
}
Usage
import { stripe } from '@irresistible/integrations';
// Create checkout session
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
line_items: [{
price: 'price_123',
quantity: 1
}],
mode: 'subscription',
success_url: 'https://myapp.com/success',
cancel_url: 'https://myapp.com/cancel'
});
Analytics Integrations
Google Analytics
// irresistible.config.js
export default {
integrations: {
analytics: {
provider: 'google',
measurementId: 'G-XXXXXXXXXX',
features: {
pageViews: true,
events: true,
ecommerce: true
}
}
}
}
Custom Events
import { analytics } from '@irresistible/integrations';
// Track event
analytics.track('purchase', {
value: 99.99,
currency: 'USD',
items: [{ id: 'SKU123', name: 'Product' }]
});
Mixpanel
// irresistible.config.js
export default {
integrations: {
analytics: {
provider: 'mixpanel',
token: process.env.MIXPANEL_TOKEN,
features: {
userProfiles: true,
persistence: true,
autoTrack: true
}
}
}
}
Email Service Integrations
SendGrid
// irresistible.config.js
export default {
integrations: {
email: {
provider: 'sendgrid',
apiKey: process.env.SENDGRID_API_KEY,
from: 'noreply@myapp.com',
templates: {
welcome: 'd-xxxxx',
resetPassword: 'd-yyyyy'
}
}
}
}
Sending Emails
import { email } from '@irresistible/integrations';
// Send templated email
await email.send({
to: 'user@example.com',
template: 'welcome',
data: {
name: 'John',
appUrl: 'https://myapp.com'
}
});
// Send custom email
await email.send({
to: 'user@example.com',
subject: 'Hello!',
html: '<p>Welcome to our app!</p>',
text: 'Welcome to our app!'
});
Monitoring Integrations
Sentry
// irresistible.config.js
export default {
integrations: {
monitoring: {
provider: 'sentry',
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
features: {
errorTracking: true,
performance: true,
profiling: true,
replay: true
}
}
}
}
Custom Error Handling
import { sentry } from '@irresistible/integrations';
try {
// Your code
} catch (error) {
sentry.captureException(error, {
tags: { section: 'checkout' },
extra: { orderId: order.id }
});
}
Authentication Integrations
Auth0
// irresistible.config.js
export default {
integrations: {
auth: {
provider: 'auth0',
domain: process.env.AUTH0_DOMAIN,
clientId: process.env.AUTH0_CLIENT_ID,
clientSecret: process.env.AUTH0_CLIENT_SECRET,
features: {
socialLogin: true,
mfa: true,
passwordless: true
}
}
}
}
Supabase
// irresistible.config.js
export default {
integrations: {
auth: {
provider: 'supabase',
url: process.env.SUPABASE_URL,
anonKey: process.env.SUPABASE_ANON_KEY,
features: {
database: true,
storage: true,
realtime: true
}
}
}
}
Custom Integrations
Webhook Handler
Create custom webhook endpoints:
// api/webhooks/custom.js
export async function POST(request) {
const signature = request.headers.get('x-webhook-signature');
const body = await request.json();
// Verify signature
if (!verifySignature(body, signature)) {
return new Response('Invalid signature', { status: 401 });
}
// Process webhook
switch (body.event) {
case 'user.created':
await handleUserCreated(body.data);
break;
case 'payment.completed':
await handlePaymentCompleted(body.data);
break;
}
return new Response('OK');
}
API Wrapper
Create wrappers for third-party APIs:
// lib/integrations/customApi.js
export class CustomAPI {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseURL = 'https://api.example.com';
}
async request(endpoint, options = {}) {
const response = await fetch(`${this.baseURL}${endpoint}`, {
...options,
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json',
...options.headers
}
});
if (!response.ok) {
throw new Error(`API Error: ${response.statusText}`);
}
return response.json();
}
async getResource(id) {
return this.request(`/resources/${id}`);
}
async createResource(data) {
return this.request('/resources', {
method: 'POST',
body: JSON.stringify(data)
});
}
}
Best Practices
1. Security
- Store API keys in environment variables
- Validate webhook signatures
- Use OAuth for user authorization
- Implement rate limiting
- Log all integration events
2. Error Handling
try {
await integration.doSomething();
} catch (error) {
// Log error
console.error('Integration error:', error);
// Notify monitoring
await monitoring.captureException(error);
// Fallback behavior
return fallbackResponse();
}
3. Testing
// tests/integrations/stripe.test.js
import { mockStripe } from '@irresistible/testing';
test('creates checkout session', async () => {
const session = await mockStripe.checkout.sessions.create({
// Test data
});
expect(session.id).toBeDefined();
expect(session.url).toContain('checkout');
});
4. Monitoring
- Track integration performance
- Monitor API rate limits
- Alert on failures
- Log all requests/responses
Troubleshooting
Common Issues
Authentication Failures
- Verify API keys
- Check permissions/scopes
- Ensure correct environment
- Validate OAuth tokens
Webhook Issues
- Verify endpoint URL
- Check signature validation
- Ensure idempotency
- Log raw payloads
Rate Limiting
- Implement exponential backoff
- Cache responses
- Use batch APIs
- Monitor usage
Next Steps
- Explore specific GitHub integration
- Set up Slack notifications
- Configure custom webhooks
- Learn about API development