Production-grade API integration and workflow orchestration system—connecting multiple tools, services, and data sources into a reliable, event-driven execution layer.
This framework provides a robust foundation for building API integrations that businesses depend on for daily operations—with built-in retry logic, error handling, and monitoring.
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Webhook │────▶│ Event │────▶│ Workflow │
│ Receiver │ │ Router │ │ Engine │
└─────────────┘ └─────────────┘ └─────────────┘
│
┌─────────────────────────────────────┼─────────────────────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ CRM │ │ Database │ │ Third │
│ Sync │ │ Sync │ │ Party │
└─────────────┘ └─────────────┘ └─────────────┘
- Webhook Management - Receive, validate, and route incoming webhooks
- Event-Driven Architecture - React to events from any connected system
- Retry Logic - Exponential backoff with configurable retry policies
- Idempotency - Guaranteed exactly-once processing
- Error Handling - Dead letter queues and alerting
- Rate Limiting - Respect API limits across all integrations
- Monitoring - Centralized logging and metrics
src/
├── api/ # API endpoints
│ ├── webhooks.py
│ └── health.py
├── core/ # Core framework
│ ├── event_router.py
│ ├── workflow_engine.py
│ ├── retry_handler.py
│ └── idempotency.py
├── connectors/ # API connectors
│ ├── base_connector.py
│ ├── rest_connector.py
│ ├── graphql_connector.py
│ └── soap_connector.py
├── integrations/ # Pre-built integrations
│ ├── salesforce.py
│ ├── hubspot.py
│ ├── stripe.py
│ ├── slack.py
│ └── postgres.py
├── workflows/ # Workflow definitions
│ ├── sync_contacts.py
│ ├── process_payment.py
│ └── notify_team.py
└── monitoring/ # Observability
├── logger.py
├── metrics.py
└── alerts.py
# Clone repository
git clone https://github.com/daveedashar/api-integration-framework.git
cd api-integration-framework
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Run the service
python -m src.mainfrom src.connectors import RESTConnector
class HubSpotConnector(RESTConnector):
base_url = "https://api.hubapi.com"
def __init__(self, api_key: str):
super().__init__()
self.headers = {"Authorization": f"Bearer {api_key}"}
def get_contacts(self, limit: int = 100):
return self.get(f"/crm/v3/objects/contacts?limit={limit}")
def create_contact(self, data: dict):
return self.post("/crm/v3/objects/contacts", json=data)from src.core import Workflow, step
class SyncContactsWorkflow(Workflow):
@step(retry=3, timeout=30)
def fetch_from_source(self, event):
return self.hubspot.get_contacts()
@step(retry=3, timeout=30)
def transform_data(self, contacts):
return [self.map_contact(c) for c in contacts]
@step(retry=5, timeout=60)
def sync_to_destination(self, contacts):
return self.salesforce.bulk_upsert(contacts)from src.api import webhook_handler
@webhook_handler("hubspot.contact.created")
def handle_new_contact(event):
workflow = SyncContactsWorkflow()
workflow.run(event)# config.yaml
retry:
max_attempts: 5
base_delay: 1 # seconds
max_delay: 60
exponential_base: 2
rate_limiting:
default_rpm: 100
per_integration:
hubspot: 150
salesforce: 100
stripe: 200
monitoring:
log_level: INFO
metrics_enabled: true
alert_on_failure: true# Built-in retry strategies
RETRY_POLICIES = {
"aggressive": RetryPolicy(max_attempts=10, base_delay=0.5),
"standard": RetryPolicy(max_attempts=5, base_delay=1),
"conservative": RetryPolicy(max_attempts=3, base_delay=5),
"no_retry": RetryPolicy(max_attempts=1),
}┌─────────────────────────────────────────────────────────────┐
│ API Integration Framework - Status Dashboard │
├─────────────────────────────────────────────────────────────┤
│ Webhooks Received (24h): 12,847 │
│ Workflows Executed: 11,923 │
│ Success Rate: 99.7% │
│ Avg Response Time: 234ms │
│ Failed (Retrying): 12 │
│ Dead Letter Queue: 3 │
└─────────────────────────────────────────────────────────────┘
# Run tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=src --cov-report=html
# Run integration tests
pytest tests/integration/ -v --integration- 99.9% reliability across all integrations
- Real-time data synchronization
- Zero data loss with idempotency
- 5-minute setup for new integrations
MIT License - see LICENSE for details.
Daud Ashar
- GitHub: @daveedashar
- LinkedIn: /in/daudashar
- Email: daud-a@consultant.com