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