Skip to content

Latest commit

 

History

History
119 lines (96 loc) · 3.56 KB

File metadata and controls

119 lines (96 loc) · 3.56 KB

HubSpot Field Mapping Fixed ✅

Updated HubSpot Integration

I've updated the HubSpot integration to properly map to your HubSpot columns:

Your HubSpot Columns:

  • Name (combines firstname + lastname)
  • Email
  • Phone Number
  • Lead Status
  • Favorite Content Topics
  • Preferred channels
  • Create Date

Mapping Implementation:

For Voters:

// When a vote is cast, the voter data is mapped as:
{
  firstname: "John",           // First part of name
  lastname: "Smith",           // Rest of name
  email: "john.smith@example.com",
  phone: "+1-555-123-4567",    // Only if provided
  hs_lead_status: "NEW",       // Valid HubSpot status
  lifecyclestage: "subscriber"
}

For Nominees:

// When a nomination is approved, the nominee data is mapped as:
{
  firstname: "Sarah",          // First part of name  
  lastname: "Johnson",         // Rest of name
  email: "sarah.johnson@company.com",
  phone: "",                   // Empty for nominees (no phone collected)
  hs_lead_status: "CONNECTED", // Valid HubSpot status
  lifecyclestage: "lead"
}

Key Fixes Applied:

  1. ✅ Name Splitting:

    • Automatically splits full names into firstname and lastname
    • Example: "John Smith" → firstname: "John", lastname: "Smith"
  2. ✅ Email Mapping:

    • Direct mapping to HubSpot email field
    • No changes needed
  3. ✅ Phone Number Mapping:

    • Maps to HubSpot phone field when available
    • Only included if phone number is provided
    • Voters can provide phone, nominees currently don't
  4. ✅ Valid Lead Status Values:

    • Fixed to use valid HubSpot options: "NEW", "CONNECTED", etc.
    • Voters get "NEW" status
    • Nominees get "CONNECTED" status

Testing Results:

Direct API Test:

# ✅ Successfully created contact with correct mapping:
{
  "firstname": "Test",
  "lastname": "Mapping Fixed", 
  "email": "test.mapping.fixed@example.com",
  "phone": "+1-555-123-4567",
  "hs_lead_status": "NEW"
}

How It Works:

  1. When someone votes:

    • Vote data includes voter info (firstName, lastName, email, phone)
    • tagVoter() function splits name and maps to HubSpot
    • Contact created/updated with voter status
  2. When nomination is approved:

    • Nominee data includes full name and email
    • tagNominee() function splits name and maps to HubSpot
    • Contact created/updated with nominee status

What to Check in HubSpot:

  1. Go to Contacts in your HubSpot account
  2. Look for contacts with emails like:
    • john.smith@example.com (voter)
    • test.mapping.fixed@example.com (test contact)
  3. Verify the fields are populated correctly:
    • Name: Should show as "John Smith" (combined from firstname/lastname)
    • Email: Should show the full email address
    • Phone Number: Should show phone when provided
    • Lead Status: Should show "NEW" or "CONNECTED"

Future Enhancements:

When you create custom properties in HubSpot, we can add:

  • WSA Category (which award category they're in)
  • WSA Year (2026)
  • Nominee Name (for voters - who they voted for)
  • Vote Count (how many votes they've cast)

The current implementation focuses on the core fields you have set up and uses valid HubSpot standard properties.

Status: Ready for Production

The HubSpot integration now correctly maps:

  • ✅ Names (split into firstname/lastname)
  • ✅ Email addresses
  • ✅ Phone numbers (when available)
  • ✅ Valid lead status values
  • ✅ Proper lifecycle stages