# Write a corrected HTML that fixes the GeoChart data columns (3 columns only: lat, lon, value) html = r""" Uplift — CRM Leads Dashboard (Routes & Cities, Fixed Map)

N8n Integration - CRM Integration Technical Specification

\n\n

Overview

\n

This specification defines the integration between the Uplift web application and N8n workflow automation platform for CRM data synchronization. The primary focus is on Hubspot integration, with extensibility for other CRM systems.

\n\n

Estimated Development Time: 31-50 hours

\n

Original Requirement: Send lead data from Uplift into Hubspot/Salesforce (Hubspot prioritized)

\n\n

System Architecture

\n\n

Core Components

\n\n\n

Integration Flow

\n
    \n
  1. System admin configures N8n instance settings
  2. \n
  3. Organization enables N8n integration with scope selection
  4. \n
  5. System creates 4 automated workflows with webhook nodes
  6. \n
  7. Hubspot private app is created with required permissions
  8. \n
  9. Data synchronization begins via cron jobs and real-time triggers
  10. \n
\n\n

Technical Implementation

\n\n

1. System-Level Configuration

\n

Add new N8n section in system settings with the following fields:

\n\n\n

2. Organization Integration Setup

\n

Within Organization > Integrations, add new N8n integration with:

\n\n

Scope Selection:

\n\n\n

Workflow Creation:

\n

System automatically creates 4 workflows with Webhook nodes:

\n
    \n
  1. Lead Creation Workflow: Handles new CRM lead data
  2. \n
  3. Lead Update Workflow: Processes lead modifications
  4. \n
  5. Request Creation Workflow: Manages new trip requests
  6. \n
  7. Request Update Workflow: Handles request changes
  8. \n
\n\n

Each workflow is named: [organization name] - [workflow type]

\n

Returns workflow IDs for tracking and management

\n\n

3. Integration Testing

\n

Built-in testing functionality:

\n
    \n
  1. Connection Test: Verify N8n API connectivity
  2. \n
  3. Dummy Data Test: Send test payload to workflows
  4. \n
  5. Response Validation: Confirm proper webhook response
  6. \n
\n\n

4. Hubspot Configuration

\n\n

Required Hubspot Permissions:

\n\n\n

Setup Process:

\n
    \n
  1. Create private app on Hubspot with required scopes
  2. \n
  3. Copy access token to organization Hubspot integration field
  4. \n
  5. Manually configure N8n workflows (initial implementation)
  6. \n
\n\n

Data Synchronization

\n\n

Synchronization Engine

\n

Develop cron job system that:

\n\n\n

Data Objects and Fields

\n\n

CRM Lead Data:

\n\n\n

Primary Channels (Related Objects):

\n\n\n

Alert Data:

\n\n\n

Trip Request Data:

\n\n\n

Data Processing Rules

\n\n\n

Event Triggers

\n\n

Events that Modify CRM Leads:

\n\n

Widget Events:

\n
    \n
  1. Sign up for alert
  2. \n
  3. Change alert settings (widget or manage alerts page)
  4. \n
  5. Inquire on flight (creates request)
  6. \n
  7. Inquire on share page
  8. \n
\n\n

App Events:

\n
    \n
  1. Create CRM lead manually
  2. \n
  3. Modify CRM lead manually
  4. \n
  5. Modify alert routes and cities
  6. \n
  7. Create requests manually
  8. \n
\n\n

N8n Workflow Configuration

\n\n

Workflow Triggering

\n\n\n

Authentication Options

\n\n

1. Basic Authentication

\n\n\n

2. Header Authentication

\n\n\n

3. JWT Authentication

\n\n\n

Multiple Environment Support

\n\n\n

Hubspot Integration Mapping

\n\n

Data Mapping Strategy

\n

Map Uplift crmLeads and related objects to HubSpot Contacts and Deals:

\n\n

Deduplication Logic:

\n
    \n
  1. Primary: Match on email address
  2. \n
  3. Secondary: Match on custom property crmLeadId
  4. \n
\n\n

Object Relationships:

\n\n\n

Standard vs. Custom Properties

\n

Identify which HubSpot properties are standard vs. must be added as custom properties for complete data mapping.

\n\n

Error Handling & Monitoring

\n\n

Failure Detection

\n

Monitor and notify for failures related to:

\n
    \n
  1. Connection Issues: N8n API connectivity problems
  2. \n
  3. Authentication Failures: Invalid credentials or expired tokens
  4. \n
  5. Workflow Execution Errors: Runtime failures in N8n workflows
  6. \n
\n\n

Integration Lifecycle

\n\n\n

User Interface

\n\n

Integration Creation Dialog

\n

Organization > Integrations page with \"N8n\" provider option:

\n\n\n

Test Integration Interface

\n

Modal dialog showing:

\n\n\n

Implementation Phases

\n\n

Phase 1: Core Integration (20-30h)

\n\n\n

Phase 2: Advanced Features (11-20h)

\n\n\n

Security Considerations

\n\n\n\n

Testing Strategy

\n\n

Integration Testing

\n\n\n

User Acceptance Testing

\n\n\n

Future Enhancements

\n\n