feat(backend): Apollo prospect search + add to sequence endpoints#154
Merged
Conversation
…dpoints
- Add SearchProspectsDto and AddPeopleToSequenceDto with class-validator
- Add ApolloProspectsService:
- searchPeople(): POST /mixed_people/search with name, title, location,
org filters; deduplicates contacts/people from Apollo response
- searchOrganizations(): GET /mixed_companies/search for company autocomplete
- addPeopleToSequence(): converts raw Apollo person IDs to contacts via
MCP apollo_contacts_create, then enrolls all via
apollo_emailer_campaigns_add_contact_ids; creates best-effort Zuko CRM
records; returns failedPersonIds for partial failures
- Add ApolloProspectsController wiring all three endpoints under
integrations/apollo/*
- Register controller + service + ContactsRepository in IntegrationsModule
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pollo API key Backend: - Add apollo-prospects.service: searchPeople via mixed_people/api_search (free, no enrichment credits), searchOrganizations via accounts/search, addPeopleToSequence via MCP apollo_emailer_campaigns_add_contact_ids - Add SearchProspectsDto with organizationDomains[] field - Use q_organization_domains_list instead of organization_ids for company filter — domains work reliably, send only one at a time to avoid conflicts - Add ApolloMcpService.listTools() debug helper - Register ApolloProspectsController + service in IntegrationsModule - Add person_read + mixed_people_api_search to OAuth scopes list Frontend: - AddContactsDialog: increase debounce to 800ms, min 3 chars for name filter - Pass organizationDomains to search params alongside organizationIds - Update OrgSearchResult type to include domain field - Update getProspectSearch query options to support organizationDomains - Update apollo.ts SearchProspectsParams with organizationDomains Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
anujeet98
approved these changes
Jun 23, 2026
anujeet98
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the backend for prospect search and the "Add Contacts to Sequence" feature. People search uses Apollo's
mixed_people/api_searchendpoint via API key — confirmed free (not on Apollo's credit-consuming endpoint list). Organization autocomplete usesaccounts/search(also free). Sequence enrollment uses the existing MCP infrastructure.What changed
Backend —
apps/backendNew:
apollo-prospects.service.tssearchPeople()—POST /mixed_people/api_searchwith API key authq_keywords), job titles (person_titles[]), locations (person_locations[]), company domain (q_organization_domains_list[])searchOrganizations()—GET /accounts/searchwith API key auth{ id, name, domain }primary_domainfor use with the domain-based people filteraddPeopleToSequence()— MCPapollo_emailer_campaigns_add_contact_idsapollo_contacts_createfailedPersonIds[]for partial failure handlingNew:
dto/prospects.dto.tsSearchProspectsDto— validated with class-validator, supportspersonName,personTitles[],personLocations[],organizationIds[],organizationDomains[],page,perPageAddPeopleToSequenceDto—sequenceId,contactIds[],personIds[],personData[]New:
apollo-prospects.controller.tsPOST /integrations/apollo/prospects/searchGET /integrations/apollo/organizations/search?name=POST /integrations/apollo/prospects/add-to-sequenceModified:
integrations.module.tsApolloProspectsController,ApolloProspectsService,ContactsRepository,ConfigModuleModified:
apollo-integration.service.tsperson_readandmixed_people_api_searchto OAuth scopes listModified:
apollo-mcp.service.tslistTools()debug helper for MCP tool discoveryFrontend —
apps/webModified:
lib/api/apollo.tsOrgSearchResult— addeddomain?: stringfieldSearchProspectsParams— addedorganizationDomains?: string[]apolloProspectsApi.searchOrgs()return type updatedModified:
server/query-options.tsgetProspectSearch— addedorganizationDomainsparam andenabledguardModified:
AddContactsDialog.tsxsearchParamspasses bothorganizationIdsandorganizationDomains(backend uses domain preferentially)OrgOptiontype updated withdomainfieldCredit usage
Confirmed via Apollo's official API pricing docs (
docs.apollo.io/docs/api-pricing):mixed_people/api_searchaccounts/searchmixed_companies/searchpeople/match,organizations/enrichArchitecture note
People search and org autocomplete use API key auth (
x-api-keyheader) — this is required becausemixed_people/api_searchis not accessible via OAuth Bearer token even when themixed_people_api_searchscope is registered on the OAuth app. The MCP-based sequence operations continue to use OAuth as before.Testing
Dependencies
Requires
APOLLO_API_KEYset inapps/backend/.env.Screenshot