How to build a sales lead generation product with Unified.to
November 15, 2023
Any lead generation solution needs to integrate with CRM (customer relationship management) applications. CRMs like HubSpot and Salesforce are the source of truth for sales professionals, centralizing core activities like contact management, deal status tracking, and email campaigns.
Unified.to makes it faster and easier for SaaS developers to add integrations to their products. Through our Unified API developer platform, developers integrate once to add multiple CRM integrations to their products simultaneously.
In this guide, we'll explore how to build a robust and scalable sales lead generation product that leverages Unified.to's pre-built CRM integrations. Seamlessly insert leads and, in some cases, companies, contacts, and deals directly into your customers' preferred CRM.
Who
You have built a Lead Generation
solution for salespeople to find more opportunities.
Why (your goal)
You need access to your customers' CRM
application to find new leads for your customers' products and to add leads to their CRM, so sales teams can follow-up on new opportunities and close deals.
What
You need to integrate seamlessly with the most popular CRM applications that are utilized by your customers, such as Salesforce, HubSpot, Pipedrive and more. This will provide your users with a streamlined user experience, ensuring efficient data flow and synchronization between your lead generation solution and their preferred CRM.
How to add CRM integrations to your product
New to Unified.to? Before we start, be sure to read this quick guide:
- Once you find a lead (or prospect) for your customer, you will then need to add them as a
Lead
orContact
in their CRM. If you are adding a contact, then you might also want to add an associated deal and company. Inserting leads or contacts into a CRM provides critical value as your customer's sales team is reliant on their CRM. All of their sales-related data, including your lead data, should be centralized within their CRM. - To add a lead use the createLead API endpoint. You should check if that lead exists by searching for the corresponding email with listLeads. We also recommend checking if there is already a contact with that same email (with listContacts).
- Leads are not associated with Deals and Companies and will rely on your customer's salesperson to migrate them to a Contact and then create a Deal and Company for that Contact.
import Unified from 'unified-ts-client'; import { ICrmLead } from 'unified-ts-client/lib/src/crm/types/UnifiedCrm'; const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN }); export async function createLead(connection_id: string, email: string, name: string): Promise<ICrmLead> { const leads = await unifiedClient.crm(connection_id).lead.getAll({ query: email, limit: 1 }) const contacts = await unifiedClient.crm(connection_id).contact.getAll({ query: email, limit: 1 }) if (!leads.length && !contacts.length) { const lead = await unifiedClient.crm(connection_id).lead.createLead({ emails: [{email}], name}); return lead; } else { return false; } }
- To add a contact, use the createContact API endpoint, but first check to see if a contact already exists with that email (using listContacts querying by email).
import Unified from 'unified-ts-client'; import { ICrmContact } from 'unified-ts-client/lib/src/crm/types/UnifiedCrm'; const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN }); export async function createContact(connection_id: string, email: string, name: string): Promise<ICrmContact> { const contacts = await unifiedClient.crm(connection_id).contact.getAll({ query: email, limit: 1 }) if (!contact.length) { const contact = await unifiedClient.crm(connection_id).contact.createContact({ emails: [{email}], name}); return contact; } else { return contacts[0]; } }
- If you are creating a Contact, you may also want to create the associated Deal and Company before and then use those IDs when creating the Contact. Again, before creating a Company, you should check if it already exists (by using listCompanies and querying on the company name).
import Unified from 'unified-ts-client'; const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN }); export async function createCompanyAndDeal(connection_id: string, contact_id: string, name: string, website: string) { const companies = await unifiedClient.crm(connection_id).company.getAll({ query: name, limit: 1 }) if (companies.length) { return; } const company = await unifiedClient.crm(connection_id).company.create({ name, website }); const deal = await unifiedClient.crm(connection_id).deal.create({ name: `${name}'s deal` }); if (company?.id && deal?.id) { const contact = await unifiedClient.crm(connection_id).contact.get(contact_id); await unifiedClient.crm(connection_id).contact.update(contact_id, { deal_ids: contact.deal_ids.concat(deal.id), company_ids: contact.company_ids.concat(company.id) }); } }
- Optionally, you can enrich the Lead/Contact and Company information by using our enrichPerson and enrichCompany endpoints. Those connections could be your own, or you could have your customers authorize access to their accounts in an enrichment application (e.g., ClearBit, ZoomInfo).
import Unified from 'unified-ts-client'; import { IEnrichPerson } from 'unified-ts-client/lib/src/enrich/types/UnifiedEnrich'; const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN }); export async function enrichPerson(connection_id: string, email: string): Promise<IEnrichPerson> { return await unifiedClient.enrich(connection_id).person.getByEmail(email); }
- Optionally, you could assign the new Lead to a salesperson. First, get that salesperson's ID by using the ListEmployees endpoint and querying on their email.
import Unified from 'unified-ts-client'; const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN }); export async function assignLead(crm_connection_id: string, lead_id: string, hris_connection_id: string, salesperson_email: string) { const salesperson = await unifiedClient.hris(hris_connection_id).employee.getAll({ query: salesperson_email }); if (salesperson?.id) { await unifiedClient.crm(crm_connection_id).lead.update(lead_id, { user_id: salesperson.id }); } }
That's it. You've now built a sales lead generation product that effectively leverages third-party CRM integrations.Questions about Unified.to?
Unified.to is a complete solution to power your sales lead generation product with CRM integrations. Meet with an integrations expert or chat with us on Discord.