Skip to main content

Third-Party API Integrations

Connect Astrio with any external service through REST APIs, GraphQL, webhooks, and custom integrations. Build powerful applications that leverage the entire ecosystem of third-party services.

Integration Types

REST APIs

Connect to any RESTful API service

GraphQL

Modern GraphQL API integrations

Webhooks

Real-time event-driven integrations

Custom Connectors

Build custom integration logic

REST API Integration

Visual API Builder

Connect to REST APIs without writing code using our visual interface.
1

Add API Endpoint

Enter the API base URL and authentication details
2

Configure Requests

Set up GET, POST, PUT, DELETE requests
3

Map Data

Define how API responses map to your application
4

Test Integration

Verify the connection and data flow

Authentication Methods

Support for all major API authentication types: API Key Authentication:
// API Key in headers
{
  "Authorization": "Bearer your-api-key",
  "X-API-Key": "your-api-key"
}

// API Key in query parameters
https://api.example.com/data?api_key=your-api-key
OAuth 2.0:
// OAuth 2.0 flow
const oauthConfig = {
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  authorizationUrl: 'https://api.example.com/oauth/authorize',
  tokenUrl: 'https://api.example.com/oauth/token',
  scopes: ['read', 'write']
}
Basic Authentication:
// Username and password
const credentials = btoa('username:password');
headers: {
  'Authorization': `Basic ${credentials}`
}

Request Configuration

Flexible request setup for any API endpoint. HTTP Methods:
  • GET - Retrieve data from the API
  • POST - Create new resources
  • PUT - Update existing resources
  • PATCH - Partial resource updates
  • DELETE - Remove resources
Request Headers:
// Common headers
{
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'User-Agent': 'Astrio-Integration/1.0',
  'Authorization': 'Bearer token'
}
Request Body:
// JSON payload
{
  "name": "John Doe",
  "email": "john@example.com",
  "age": 30
}

// Form data
{
  "name": "John Doe",
  "file": "base64-encoded-file"
}

GraphQL Integration

GraphQL Schema Introspection

Automatically discover and integrate with GraphQL APIs. Schema Discovery:
# Introspection query
query IntrospectionQuery {
  __schema {
    types {
      name
      fields {
        name
        type {
          name
        }
      }
    }
  }
}
Query Builder:
  • Visual Query Builder - Drag-and-drop interface for building queries
  • Schema Explorer - Browse available types and fields
  • Query Validation - Real-time query validation
  • Response Preview - See query results before saving

GraphQL Features

Advanced GraphQL integration capabilities.

Queries

Fetch data with complex queries

Mutations

Create, update, and delete data

Subscriptions

Real-time data updates

Fragments

Reusable query components
Example GraphQL Integration:
# User query with fragments
fragment UserFields on User {
  id
  name
  email
  profile {
    avatar
    bio
  }
}

query GetUser($id: ID!) {
  user(id: $id) {
    ...UserFields
    posts {
      id
      title
      content
    }
  }
}

Webhook Integration

Incoming Webhooks

Receive real-time data from external services. Webhook Setup:
// Webhook endpoint configuration
{
  endpoint: '/webhooks/external-service',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Webhook-Secret': 'your-secret'
  },
  validation: 'signature'
}
Webhook Security:
  • Signature Verification - Verify webhook authenticity
  • Secret Validation - Validate webhook secrets
  • IP Whitelisting - Restrict webhook sources
  • Rate Limiting - Prevent webhook abuse

Outgoing Webhooks

Send data to external services when events occur. Event Triggers:
// Trigger webhook on user registration
{
  event: 'user.created',
  webhook: 'https://external-service.com/webhook',
  payload: {
    userId: '{{user.id}}',
    email: '{{user.email}}',
    timestamp: '{{timestamp}}'
  }
}
Webhook Retry Logic:
  • Exponential Backoff - Smart retry with increasing delays
  • Maximum Retries - Configurable retry limits
  • Dead Letter Queue - Store failed webhooks for review
  • Success Monitoring - Track webhook delivery success

Communication Services

Slack Integration:
// Send message to Slack channel
{
  method: 'POST',
  url: 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL',
  body: {
    text: 'New user registered: {{user.name}}',
    channel: '#notifications'
  }
}
Discord Webhooks:
// Discord webhook configuration
{
  url: 'https://discord.com/api/webhooks/YOUR/WEBHOOK',
  content: 'New order received: ${{order.total}}',
  embeds: [{
    title: 'Order Details',
    description: 'Order #{{order.id}}',
    color: 0x00ff00
  }]
}
Email Services (SendGrid, Mailchimp):
// SendGrid email integration
{
  method: 'POST',
  url: 'https://api.sendgrid.com/v3/mail/send',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: {
    personalizations: [{
      to: [{ email: '{{user.email}}' }]
    }],
    from: { email: 'noreply@yourdomain.com' },
    subject: 'Welcome to our platform!',
    content: [{
      type: 'text/html',
      value: 'Welcome {{user.name}}!'
    }]
  }
}

Analytics and Monitoring

Google Analytics:
// Track custom events
{
  method: 'POST',
  url: 'https://www.google-analytics.com/collect',
  body: {
    v: 1,
    tid: 'GA_TRACKING_ID',
    cid: '{{user.id}}',
    t: 'event',
    ec: 'User',
    ea: 'Registration',
    el: '{{user.email}}'
  }
}
Mixpanel:
// Track user events
{
  method: 'POST',
  url: 'https://api.mixpanel.com/track',
  body: {
    event: 'User Registered',
    properties: {
      distinct_id: '{{user.id}}',
      email: '{{user.email}}',
      time: '{{timestamp}}'
    }
  }
}

File Storage and Media

AWS S3:
// Upload file to S3
{
  method: 'PUT',
  url: 'https://your-bucket.s3.amazonaws.com/{{file.name}}',
  headers: {
    'Authorization': 'AWS4-HMAC-SHA256 Credential=...',
    'Content-Type': '{{file.type}}'
  },
  body: '{{file.data}}'
}
Cloudinary:
// Upload image to Cloudinary
{
  method: 'POST',
  url: 'https://api.cloudinary.com/v1_1/YOUR_CLOUD_NAME/image/upload',
  body: {
    file: '{{file.data}}',
    public_id: '{{file.name}}',
    folder: 'users/{{user.id}}'
  }
}

Custom Integration Development

Custom Connectors

Build custom integration logic for complex scenarios. JavaScript Functions:
// Custom data transformation
function transformUserData(user) {
  return {
    external_id: user.id,
    name: `${user.firstName} ${user.lastName}`,
    email: user.emailAddress,
    metadata: {
      source: 'astrio',
      created_at: new Date().toISOString()
    }
  };
}

// Custom validation
function validateWebhook(payload, signature) {
  const expectedSignature = crypto
    .createHmac('sha256', process.env.WEBHOOK_SECRET)
    .update(JSON.stringify(payload))
    .digest('hex');
  
  return signature === expectedSignature;
}

Integration Templates

Pre-built templates for common integration patterns. E-commerce Integration:
// Shopify integration template
{
  name: 'Shopify Integration',
  endpoints: {
    products: 'https://{{shop}}.myshopify.com/admin/api/2023-01/products.json',
    orders: 'https://{{shop}}.myshopify.com/admin/api/2023-01/orders.json',
    customers: 'https://{{shop}}.myshopify.com/admin/api/2023-01/customers.json'
  },
  authentication: {
    type: 'api_key',
    header: 'X-Shopify-Access-Token'
  }
}

Data Mapping and Transformation

Field Mapping

Map data between your application and external services. Simple Mapping:
// Direct field mapping
{
  "user.name": "external_user.full_name",
  "user.email": "external_user.email_address",
  "user.created_at": "external_user.registration_date"
}
Complex Transformations:
// Data transformation functions
{
  "user.full_name": "concat(user.first_name, ' ', user.last_name)",
  "user.age": "calculate_age(user.birth_date)",
  "user.status": "if(user.is_active, 'active', 'inactive')"
}

Data Validation

Ensure data integrity across integrations. Validation Rules:
// Email validation
{
  field: 'user.email',
  type: 'email',
  required: true
}

// Phone number validation
{
  field: 'user.phone',
  type: 'phone',
  format: 'international'
}

// Custom validation
{
  field: 'user.age',
  validator: 'min:18',
  message: 'User must be 18 or older'
}

Error Handling and Monitoring

Error Handling

Comprehensive error handling for integration failures. Retry Logic:
// Retry configuration
{
  maxRetries: 3,
  retryDelay: 1000, // milliseconds
  backoffMultiplier: 2,
  retryOnStatus: [500, 502, 503, 504]
}
Error Responses:
// Handle different error types
{
  '400': 'Bad Request - Check request format',
  '401': 'Unauthorized - Verify API credentials',
  '403': 'Forbidden - Check API permissions',
  '429': 'Rate Limited - Wait before retrying',
  '500': 'Server Error - Contact service provider'
}

Integration Monitoring

Monitor integration health and performance. Health Checks:
  • Connection Status - Verify API connectivity
  • Response Times - Monitor API performance
  • Error Rates - Track integration failures
  • Data Quality - Validate data integrity
Alerting:
// Alert configuration
{
  errorThreshold: 5, // errors per minute
  responseTimeThreshold: 5000, // milliseconds
  notificationChannels: ['email', 'slack'],
  escalationPolicy: 'immediate'
}

Security and Compliance

API Security

Secure your third-party integrations.

API Key Management

Secure storage and rotation of API keys

Request Signing

Digital signatures for API requests

Rate Limiting

Prevent API abuse and stay within limits

Data Encryption

Encrypt sensitive data in transit and at rest

Compliance Features

Meet regulatory requirements for data handling. Data Protection:
  • GDPR Compliance - European data protection
  • Data Minimization - Only collect necessary data
  • Right to Deletion - Honor data deletion requests
  • Audit Logging - Complete integration audit trail

Getting Started

Quick Integration Setup

Connect to your first third-party service:
1

Choose Service

Select the third-party service you want to integrate
2

Get API Credentials

Obtain API keys or authentication details
3

Configure Integration

Set up the integration in Astrio dashboard
4

Test Connection

Verify data flow and error handling

Best Practices

Optimize your third-party integrations:

Start Simple

Begin with basic integrations and add complexity

Handle Errors

Implement comprehensive error handling

Monitor Performance

Track integration health and response times

Secure Credentials

Never expose API keys in client-side code

Integration Support

Need help with complex integrations?
Our integration experts can help you connect to any third-party service. Contact support@astrio.app for custom integration assistance.
Use webhooks for real-time data synchronization and REST APIs for on-demand data access. GraphQL is great for complex data requirements.
Always validate and sanitize data from third-party APIs before using it in your application. Implement proper rate limiting to avoid API abuse.