@memberjunction/actions-apollo
v2.123.1
Published
Action classes that wrap the Apollo.io data enrichment API for contacts and accounts
Keywords
Readme
@memberjunction/actions-apollo
Apollo.io data enrichment action classes for MemberJunction that enable automated enrichment of contact and account records using the Apollo.io API.
Overview
This package provides two primary action classes that integrate with Apollo.io's data enrichment services:
- ApolloAccountsEnrichmentAction - Enriches account/organization records with company information, technologies used, and associated contacts
- ApolloContactsEnrichmentAction - Enriches contact records with verified email addresses, employment history, and education details
These actions are designed to work within the MemberJunction framework and can be configured through action parameters to map Apollo.io data to your custom entity fields.
Installation
npm install @memberjunction/actions-apolloPrerequisites
- An active Apollo.io account with API access
- Apollo.io API key (set as environment variable
APOLLO_API_KEY) - MemberJunction framework properly configured
- Target entities for storing enriched data (Accounts, Contacts, etc.)
Configuration
Environment Variables
APOLLO_API_KEY=your_apollo_api_key_hereConfiguration Constants
The package uses the following configuration values (defined in config.ts):
ApolloAPIEndpoint: 'https://api.apollo.io/v1' - Apollo.io API base URLEmailSourceName: 'Apollo.io' - Source name for enriched emailsGroupSize: 10 - Maximum records per API batch requestConcurrentGroups: 1 - Number of concurrent API request groupsMaxPeopleToEnrichPerOrg: 500 - Maximum contacts to enrich per organizationApolloAPIKey: Read from environment variableAPOLLO_API_KEY
Usage
Apollo Accounts Enrichment Action
This action enriches account/organization records by looking up company information using domain names.
Parameters
The action accepts the following parameters as JSON strings:
Required:
AccountEntityFieldNameJSON- Maps account entity fields
Optional:
AccountTechnologyEntityFieldNameJSON- Maps account technology relationship fieldsTechnologyCategoryEntityFieldNameJSON- Maps technology category fieldsContactEntityFieldNameJSON- Maps contact entity fieldsContactEducationHistoryEntityFieldNameJSON- Maps contact education history fields
AccountEntityFieldNameJSON Structure:
{
EntityName: string; // Target entity name (e.g., "Accounts")
DomainParamName: string; // Field containing company domain
AccountIDName: string; // Primary key field name
EnrichedAtField: string; // Timestamp field for tracking enrichment
ExtraFilter?: string; // SQL filter for selecting records to process
// Optional mapping fields
AddressFieldName?: string; // Street address field
CityFieldNameName?: string; // City field
StateProvinceFieldName?: string; // State/province field
PostalCodeFieldName?: string; // Postal code field
DescriptionFieldName?: string; // Company description field
PhoneNumberFieldName?: string; // Phone number field
CountryFieldName?: string; // Country field
LinkedInFieldName?: string; // LinkedIn URL field
LogoURLFieldName?: string; // Company logo URL field
FacebookFieldName?: string; // Facebook URL field
TwitterFieldName?: string; // Twitter URL field
}AccountTechnologyEntityFieldNameJSON Structure:
{
EntityName: string; // Technology relationship entity name
AccountIDFieldName: string; // Foreign key to account
TechnologyIDFieldName: string; // Foreign key to technology
MatchFoundFieldName: string; // Field indicating if match was found
EndedUseAtFieldName: string; // Field for marking end of technology use
}Example Usage
import { ApolloAccountsEnrichmentAction } from '@memberjunction/actions-apollo';
import { ActionEngine } from '@memberjunction/actions';
// Register the action with the engine
const engine = new ActionEngine();
const action = new ApolloAccountsEnrichmentAction();
// Execute the action
const result = await engine.RunAction({
ActionName: 'Apollo Enrichment - Accounts',
Params: [
{
Name: 'AccountEntityFieldNameJSON',
Value: JSON.stringify({
EntityName: 'Accounts',
DomainParamName: 'Domain',
AccountIDName: 'ID',
EnrichedAtField: 'LastEnrichedAt',
// ... other mappings
})
}
],
ContextUser: currentUser
});Apollo Contacts Enrichment Action
This action enriches contact records by matching on name and email combinations.
Parameters
The action accepts the following string parameters:
Required:
EntityName- Target entity name containing contactsEmailField- Field name containing email addressesFirstNameField- Field name containing first namesLastNameField- Field name containing last namesAccountNameField- Field name containing account/organization namesEnrichedAtField- Field name for tracking enrichment timestampFilterParam- SQL filter for selecting records to process
Optional:
domainParam- Field name containing company domainlinkedinParam- Field name for storing LinkedIn URLsEmploymentHistoryFieldMappings- JSON string with employment history field mappingsEducationHistoryFieldMappings- JSON string with education history field mappings
EmploymentHistoryFieldMappings Structure:
{
EmploymentHistoryEntityName: string; // Employment history entity name
EmploymentHistoryContactIDFieldName: string; // Foreign key to contact
EmploymentHistoryOrganizationFieldName: string; // Organization name field
EmploymentHistoryTitleFieldName: string; // Job title field
}EducationHistoryFieldMappings Structure:
{
EducationHistoryEntityName: string; // Education history entity name
EducationtHistoryContactIDFieldName: string; // Foreign key to contact
EducationtHistoryInstitutionFieldName: string; // Institution name field
EducationtHistoryDegreeFieldName: string; // Degree field
}Example Usage
import { ApolloContactsEnrichmentAction } from '@memberjunction/actions-apollo';
const result = await engine.RunAction({
ActionName: 'Apollo Enrichment - Contacts',
Params: [
{ Name: 'EntityName', Value: 'Contacts' },
{ Name: 'EmailField', Value: 'Email' },
{ Name: 'FirstNameField', Value: 'FirstName' },
{ Name: 'LastNameField', Value: 'LastName' },
{ Name: 'AccountNameField', Value: 'AccountName' },
{ Name: 'EnrichedAtField', Value: 'LastEnrichedAt' },
{ Name: 'FilterParam', Value: 'Email IS NOT NULL AND LastEnrichedAt IS NULL' },
{ Name: 'domainParam', Value: 'Domain' },
{ Name: 'linkedinParam', Value: 'LinkedIn' },
{
Name: 'EmploymentHistoryFieldMappings',
Value: JSON.stringify({
EmploymentHistoryEntityName: 'ContactEmploymentHistory',
EmploymentHistoryContactIDFieldName: 'ContactID',
EmploymentHistoryOrganizationFieldName: 'Organization',
EmploymentHistoryTitleFieldName: 'Title'
})
}
],
ContextUser: currentUser
});Features
Account Enrichment
- Company information (address, phone, description, social media URLs)
- Technology stack detection and tracking
- Automatic contact discovery and creation
- Technology category management
- Historical technology usage tracking
Contact Enrichment
- Bulk email verification and discovery (up to 10 contacts per API call)
- Employment history tracking with date ranges
- Education history tracking with degree information
- Social media profile URLs (LinkedIn, Twitter, Facebook)
- Title exclusion filtering (excludes members, students, volunteers)
- Pagination support for processing large datasets
- Duplicate contact detection across accounts
Error Handling & Rate Limiting
- Automatic retry with intelligent backoff for rate limits (1 minute for general limits, 1 hour for hourly limits)
- Handles both per-minute and per-hour rate limits with different wait times
- Comprehensive error logging using MemberJunction's logging system
- Batch processing to optimize API usage and respect Apollo.io limits
- Graceful handling of missing or incomplete data
- Transaction rollback support for failed operations
API Integration
The package integrates with the following Apollo.io API endpoints:
/organizations/enrich- Organization enrichment/people/bulk_match- Bulk contact matching/mixed_people/search- People search by domain
Dependencies
@memberjunction/core- Core MemberJunction functionality@memberjunction/core-entities- Entity definitions@memberjunction/actions- Action framework@memberjunction/global- Global utilitiesaxios- HTTP client for API requests
Best Practices
Batch Processing: The actions automatically batch records to optimize API usage and respect rate limits.
Field Mapping: Carefully map Apollo.io fields to your entity fields to ensure data consistency.
Filtering: Use the filter parameters to process only records that need enrichment, avoiding unnecessary API calls.
Error Monitoring: Monitor the action logs for failed enrichments and rate limit issues.
Data Quality: The actions include validation for email domains and exclude certain titles to maintain data quality.
Limitations
- Maximum 10 records per bulk API request (Apollo.io limitation)
- Rate limits apply based on your Apollo.io subscription (handled automatically with retries)
- Personal emails may not be revealed in GDPR-compliant regions
- Some enrichment data may be incomplete depending on Apollo.io's data coverage
- Account enrichment processes domains sequentially to avoid overwhelming the system
- Contact enrichment uses pagination with a maximum of 500 contacts per organization
- Excluded job titles (member, student member, student, volunteer) are automatically skipped
Troubleshooting
Common Issues
- Missing API Key: Ensure
APOLLO_API_KEYenvironment variable is set - Rate Limits: The action will automatically retry after waiting for rate limit windows
- No Matches Found: Check that input data (domains, emails) are valid and formatted correctly
- Field Mapping Errors: Verify that all mapped fields exist in your target entities
Debug Logging
The actions use MemberJunction's logging system. Monitor logs for:
- Enrichment progress
- API response details
- Error messages
- Rate limit notifications
Contributing
This package is part of the MemberJunction open-source project. Contributions are welcome following the project's contribution guidelines.
License
ISC License - see the MemberJunction project license for details.
