HubSpot Integration
Connect Ledly to HubSpot to automatically sync leads as Contacts. This guide walks you through creating a developer app and authorizing Ledly.
HubSpot uses Contacts (not Leads) with a lifecyclestage property set to lead to represent leads.
Prerequisites
- HubSpot account with Admin access
- Access to HubSpot Developer Portal
- Ledly Education or Enterprise plan
Step 1: Create a HubSpot Developer App
- Go to the HubSpot Developer Portal
- Click Manage apps in the top navigation
- Click Create app
App Info
| Field | Value |
|---|---|
| Public app name | Ledly Integration |
| Description | Syncs leads between Ledly and HubSpot |
| Logo | Optional |
Auth Settings
-
Click the Auth tab
-
Set Redirect URL to:
https://api.ledly.io/api/hubspot/callback -
Under Scopes, add the following:
crm.objects.contacts.readcrm.objects.contacts.writecrm.schemas.contacts.readcrm.schemas.contacts.write
-
Click Save
Step 2: Get Your Credentials
- On your app page, click the Auth tab
- Copy these values:
- Client ID
- Client Secret
Security Note: Keep these credentials secure. Never share them via email or chat.
Step 3: Create the Ledly Custom Property
Before connecting, create a custom property in HubSpot to track Ledly lead IDs:
- In HubSpot, go to Settings (gear icon)
- Navigate to Properties under Data Management
- Select Contact properties
- Click Create property
| Field | Value |
|---|---|
| Object type | Contact |
| Group | Contact information |
| Label | Ledly ID |
| Internal name | ledly_id |
| Field type | Single-line text |
- Click Create
The ledly_id property is required for bidirectional sync. Ledly uses this to identify which contacts originated from or are linked to Ledly.
Step 4: Enter Credentials in Ledly
- Log in to Ledly at app.ledly.io
- Go to Settings -> CRM Integration
- Select HubSpot as your CRM
- Enter your Client ID
- Enter your Client Secret
- Click Save Credentials
- Click Connect with HubSpot
- Log in to HubSpot when prompted and approve access
Once connected, you’ll see the connection status and your HubSpot portal ID on the CRM settings page.
Step 5: Map Fields to HubSpot
After connecting, configure how Ledly fields map to your HubSpot Contact properties.
- Go to Settings -> CRM Integration -> Field Mapping
- For each Ledly field, select the corresponding HubSpot property
- Click Save Mapping
Standard Field Mappings
| Ledly Field | HubSpot Contact Property | Notes |
|---|---|---|
email | email | Required, unique identifier |
first_name | firstname | |
last_name | lastname | |
phone | phone | |
company | company | |
job_title | jobtitle | |
ledly_id | ledly_id | Custom property for sync |
Lifecycle Stage Mapping
Ledly automatically sets the lifecyclestage property based on lead status:
| Ledly Status | HubSpot Lifecycle Stage |
|---|---|
new | lead |
contacted | lead |
qualified | marketingqualifiedlead |
converted | salesqualifiedlead |
Custom Field Mappings
Map Ledly custom fields to your HubSpot custom properties:
| Ledly Field | HubSpot Property |
|---|---|
program_code | program_interest |
start_date | preferred_start_date |
utm_source | hs_analytics_source |
Field mapping must be configured before leads will sync to HubSpot. Unmapped fields will not be sent.
For detailed mapping options, see the Field Mapping Guide.
Bidirectional Sync
Ledly supports bidirectional sync with HubSpot, keeping data consistent across both platforms.
Ledly to HubSpot
When a lead is created or updated in Ledly:
- Ledly checks if a Contact with matching email exists in HubSpot
- If found, the existing Contact is updated
- If not found, a new Contact is created with
lifecyclestage=lead - The
ledly_idproperty is set for tracking
HubSpot to Ledly
When a Contact is updated in HubSpot:
- HubSpot sends a webhook notification to Ledly
- Ledly matches the Contact by
ledly_idor email - Mapped fields are updated in Ledly
- Conflict resolution uses “last write wins” by default
Sync Frequency
| Direction | Trigger | Latency |
|---|---|---|
| Ledly -> HubSpot | Immediate on save | < 5 seconds |
| HubSpot -> Ledly | Webhook | < 10 seconds |
| Full sync | Scheduled | Every 4 hours |
Status Tracking
Ledly tracks the sync status for each lead:
| Status | Description |
|---|---|
synced | Successfully synced to HubSpot |
pending | Queued for sync |
failed | Sync failed (see error details) |
not_mapped | No field mapping configured |
View sync status in Ledly:
- Go to Leads -> Select a lead
- Click the CRM Sync tab
- View sync history and any error messages
Webhook Configuration
For real-time updates from HubSpot to Ledly, configure webhooks:
Step 1: Create a Webhook Subscription
- In the HubSpot Developer Portal, go to your app
- Click the Webhooks tab
- Set Target URL to:
https://api.ledly.io/api/hubspot/webhook
Step 2: Subscribe to Events
Add subscriptions for these events:
| Object | Event Type |
|---|---|
contact | contact.creation |
contact | contact.propertyChange |
contact | contact.deletion |
Step 3: Verify in Ledly
- Go to Settings -> CRM Integration -> Webhooks
- Confirm the webhook status shows Active
- Test by updating a contact in HubSpot
Ledly automatically verifies webhook signatures using your Client Secret to ensure requests are authentic.
Rate Limits
HubSpot enforces API rate limits that Ledly respects:
| Limit Type | Value |
|---|---|
| Standard | 100 requests per 10 seconds |
| Daily | 250,000 requests per day |
| Burst | 150 requests per 10 seconds (temporary) |
If you have a high volume of leads, consider upgrading your HubSpot plan for higher API limits.
Token Expiration
- Access tokens expire after 6 hours
- Ledly automatically refreshes tokens before expiration
- Refresh tokens do not expire unless revoked
Troubleshooting
”Invalid Client ID” Error
- Double-check the Client ID was copied correctly from the Developer Portal
- Ensure there are no extra spaces in the credentials
- Verify your app is published (not in draft mode)
“Redirect URI Mismatch” Error
- Verify the Redirect URL in your app matches exactly:
https://api.ledly.io/api/hubspot/callback - Check for trailing slashes or http vs https
”Scope Not Authorized” Error
- Ensure all required scopes are added to your app
- Re-authorize the connection in Ledly to grant new scopes
Contacts Not Syncing
- Check that field mapping is configured
- Verify the
ledly_idcustom property exists in HubSpot - Check the lead’s CRM Sync tab for error details
- Ensure HubSpot API limits haven’t been exceeded
Duplicate Contacts Created
- Ledly uses email as the unique identifier
- Ensure email addresses are valid and not empty
- Check HubSpot’s duplicate management settings
Webhook Events Not Received
- Verify the webhook URL is correct
- Check that webhook subscriptions are active in HubSpot
- Ensure your app has the required scopes
- Check the Webhooks tab in Ledly for delivery logs
Security Best Practices
- Rotate credentials periodically - Generate a new Client Secret every 6-12 months
- Use least privilege - Only grant the OAuth scopes Ledly needs
- Monitor access - Review connected apps in HubSpot Settings -> Integrations
- Revoke if compromised - If credentials are exposed, immediately regenerate the Client Secret
Revoking Access
In Ledly
- Go to Settings -> CRM Integration
- Click Disconnect
In HubSpot
- Go to Settings -> Integrations -> Connected Apps
- Find
Ledly Integration - Click Uninstall
Or to remove the developer app completely:
- Go to the HubSpot Developer Portal
- Click Manage apps
- Find your app and click Delete
Support
If you encounter issues:
- Email: [email protected]
- Include your HubSpot portal ID (Settings -> Account Defaults)
- Do NOT send credentials via email