A middleware solution that facilitates OAuth2 authentication with third-party services and retrieves data from them. Users can connect their accounts to services like Airtable, Notion, and HubSpot through the web interface, and then load data from these services for further use.
- Secure OAuth2 Implementation: Complete OAuth2 flows with PKCE for enhanced security (Airtable) and standard OAuth2 (Notion, HubSpot)
- Multiple Service Integrations: Pre-built integrations with Airtable, Notion, and HubSpot
- Temporary Credential Storage: Secure storage of OAuth credentials with automatic cleanup using Redis
- Standardized Data Model: Consistent
IntegrationItemdata model across all services - Modular Architecture: Clean separation of concerns with clear backend and frontend structure
- Responsive UI: Modern React-based interface with Material-UI components
- Comprehensive Error Handling: Robust error handling throughout the application
backend/
├── main.py # FastAPI application entry point
├── redis_client.py # Redis client for temporary storage
├── requirements.txt # Python dependencies
└── integrations/ # Third-party service integrations
├── airtable.py # Airtable integration implementation
├── notion.py # Notion integration implementation
├── hubspot.py # HubSpot integration implementation
└── integration_item.py # Standardized data model
frontend/
├── src/
│ ├── App.js # Main application component
│ ├── index.js # Entry point for the React app
│ ├── index.css # Global CSS styles
│ ├── integration-form.js # Main form for selecting integrations
│ ├── data-form.js # Component for loading/displaying data
│ └── integrations/ # Integration-specific components
│ ├── airtable.js # Airtable connection UI/logic
│ ├── notion.js # Notion connection UI/logic
│ ├── hubspot.js # HubSpot connection UI/logic
│ └── slack.js # Slack integration (placeholder)
├── package.json # npm dependencies and scripts
└── public/ # Static assets
Note: A slack.js placeholder file exists in the integrations/ folder, but Slack integration is not part of the current assessment scope. Only Airtable, Notion, and HubSpot are implemented/required.
- Python 3.8+ for backend
- Node.js 14+ for frontend
- Redis server for temporary storage of OAuth states and credentials
- Third-party API credentials for Airtable, Notion, and HubSpot integrations
Navigate to the backend directory and install the required Python packages:
cd backend
pip install -r requirements.txtKey dependencies include:
- FastAPI and Uvicorn for the web framework
- Redis for temporary storage
- Httpx for asynchronous HTTP requests
- Cryptography for security
- Pydantic for data validation
-
Install Redis server on your system:
- Windows: Download from Redis for Windows
- macOS:
brew install redis - Linux:
sudo apt-get install redis-server
-
Start Redis server:
redis-server
-
The backend connects to Redis at
localhost:6379by default. You can customize this with theREDIS_HOSTenvironment variable.
The backend requires the following environment variables:
REDIS_HOST(optional): Redis server host (default: localhost)
For third-party integrations, you'll need to update the hardcoded values in:
- Airtable:
backend/integrations/airtable.py(CLIENT_ID and CLIENT_SECRET) - Notion:
backend/integrations/notion.py(CLIENT_ID and CLIENT_SECRET) - HubSpot:
backend/integrations/hubspot.py(CLIENT_ID and CLIENT_SECRET)
From the backend directory, run:
uvicorn main:app --reload --host 0.0.0.0 --port 8000The backend will be available at http://localhost:8000
Navigate to the frontend directory and install dependencies:
cd frontend
npm installKey dependencies include:
- React and ReactDOM for the UI framework
- Material UI (@mui/material) for components
- Axios for HTTP requests
The frontend does not require any environment variables. All API endpoints are hardcoded to connect to http://localhost:8000.
From the frontend directory, run:
npm startThe frontend will be available at http://localhost:3000
- Go to Airtable Developers
- Create a new application
- Get the Client ID and Client Secret
- Update
backend/integrations/airtable.pywith your credentials - Set the redirect URI to
http://localhost:8000/integrations/airtable/oauth2callback
- Go to Notion Integrations
- Create a new integration
- Get the Client ID and Client Secret
- Update
backend/integrations/notion.pywith your credentials - Set the redirect URI to
http://localhost:8000/integrations/notion/oauth2callback
- Go to HubSpot Developer Portal
- Create a new app
- Get the Client ID and Client Secret
- Update
backend/integrations/hubspot.pywith your credentials - Set the redirect URI to
http://localhost:8000/integrations/hubspot/oauth2callback
The backend is built with FastAPI, a modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints.
- Entry point for the FastAPI application
- Configures CORS middleware to allow communication with the frontend
- Defines all API endpoints for the integrations
- Provides a simple interface for storing and retrieving temporary data
- Used for storing OAuth states and credentials during the authentication flow
- Credentials are automatically expired after 10 minutes for security
Each integration (Airtable, Notion, HubSpot) has its own module with:
- OAuth flow implementation
- Data fetching functions
- Credential handling
The frontend is built with React, a JavaScript library for building user interfaces, and Material-UI for components.
- Entry point for the React application
- Renders the main IntegrationForm component
- Main form for selecting and connecting to integrations
- Dynamically loads the appropriate integration component based on user selection
- Handles user input for user ID and organization ID
- Component for loading and displaying data from connected integrations
- Sends credentials to the backend and displays the returned data
Each integration (Airtable, Notion, HubSpot) has its own component with:
- UI for connecting to the service
- Logic for handling the OAuth flow
- State management for connection status
The Airtable integration implements OAuth 2.0 with PKCE (Proof Key for Code Exchange) for enhanced security:
- Authorization Request: Generates a random state parameter and code verifier/challenge for PKCE
- Callback Handling: Validates state and exchanges authorization code for access tokens
- Data Fetching: Retrieves bases and tables from Airtable API
- Credential Handling: Stores credentials in Redis with 10-minute expiration
The Notion integration implements standard OAuth 2.0:
- Authorization Request: Generates a state parameter for CSRF protection
- Callback Handling: Validates state and exchanges authorization code for access tokens
- Data Fetching: Uses Notion's search API to fetch pages/databases
- Credential Handling: Stores credentials in Redis with 10-minute expiration
The HubSpot integration implements standard OAuth 2.0:
- Authorization Request: Generates a state parameter for CSRF protection
- Callback Handling: Validates state and exchanges authorization code for access tokens
- Data Fetching: Retrieves contacts, companies, and deals from HubSpot API
- Credential Handling: Stores credentials in Redis with 10-minute expiration
A placeholder file (slack.js) exists in the frontend integrations folder. This was included in the repository template but was not part of the technical assessment requirements.
- Start Redis server
- Start the backend server
- Start the frontend development server
- Open
http://localhost:3000in your browser - Connect to Airtable, Notion, or HubSpot using the UI
- User selects integration and clicks "Connect"
- Frontend requests authorization URL from backend
- Backend generates URL and stores state in Redis
- Frontend opens popup with authorization URL
- User authenticates with third-party service
- Service redirects to backend callback
- Backend validates, exchanges code for tokens
- Backend stores credentials in Redis
- Frontend retrieves credentials after popup closure
- User clicks "Load Data" in DataForm
- Frontend sends credentials to backend
- Backend fetches data from third-party service
- Backend returns standardized IntegrationItem objects
- Frontend displays data
To test the HubSpot integration:
- Ensure you have HubSpot API credentials (Client ID and Client Secret)
- Update the credentials in
backend/integrations/hubspot.py - Start all required services (Redis, backend, frontend)
- Open the application in your browser
- Select "HubSpot" from the integration type dropdown
- Enter your User ID and Organization ID
- Click "Connect to HubSpot"
- Authenticate with your HubSpot account in the popup window
- After successful authentication, the button will change to "HubSpot Connected"
- Click "Load Data" to retrieve contacts, companies, and deals from HubSpot
- The retrieved data will be displayed in the text field
For debugging purposes, the IntegrationItem objects retrieved from HubSpot are printed to the console in the backend. You can view these by checking the backend server logs.
We welcome contributions to the VectorShift Integration Platform! Here's how you can help:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Follow the existing patterns for new integrations
- Maintain consistent error handling
- Use the standardized
IntegrationItemdata model - Keep frontend components modular and reusable
- Create backend integration file in
backend/integrations/ - Implement OAuth flow functions
- Create data fetching functions
- Add routes to
backend/main.py - Create frontend component in
frontend/src/integrations/ - Add integration to mapping in
frontend/src/integration-form.js - Add endpoint mapping in
frontend/src/data-form.js
-
Error Handling Improvements:
- Add specific exception handling for network errors
- Implement more descriptive error messages
- Add logging for debugging OAuth flow issues
-
Token Refresh Mechanisms:
- Implement automatic token refresh before API calls
- Store refresh tokens securely in Redis
- Add proper error handling for refresh token failures
-
UI Enhancements:
- Create dedicated data visualization components
- Implement tabbed interface for different object types
- Add search and filtering capabilities
-
New Integration Possibilities:
- Salesforce, Pipedrive, Zoho CRM
- Slack, Microsoft Teams, Zoom
- Mailchimp, Marketo, HubSpot Marketing
- Asana, Trello, Monday.com
- Shopify, WooCommerce, Magento
- Google Analytics, Tableau, Power BI
