Automated Lead Routing

Send warm leads that are collected within your application directly to user's CRMs for immediate follow-up.

Use Case Overview

Key Model(s) and FieldsSupported Applications
Leads

firstName
lastName
emailAddresses
phoneNumbers
company

Tasks
taskSubject
taskContent
taskOwner
taskStatus
Salesforce CRM, HubSpot, MS Dynamics CRM, Zoho CRM

📘

Data Flow: Your App -> CRM

This is a write integration. In this use case example, you can POST and PUT/PATCH target resources to help users follow up on their leads quickly.


How to build this use case with Alloy's Unified API

1. Create a Connection

To get started, you'll need to first implement Alloy's Unified API and create a connection. A connection represents each time an end user links an app to Alloy's Unified API. See Creating a Connection in our Unified API Quickstart.

Your end-users authenticate integrations using the Alloy Modal.

Your end-users authenticate integrations using the Alloy Modal.

If you’ve already done this, read on!

2. Create leads in your user’s CRM

Call the POST Create Leads endpoint to sync new leads from your application to your user's CRM. Your request will be structured like this:

curl --request POST \
     --url 'https://embedded.runalloy.com/2023-06/one/crm/leads?credentialId=CREDENTIAL_ID' \
     --header 'Authorization: Bearer YOUR_API_KEY' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "lastName": "Gold",
  "firstName": "Kelly",
  "leadSource": "Inbound",
  "company": "Alloy",
  "emailAddresses": [
    {
      "emailAddressType": "Main",
      "emailAddress": "[email protected]"
    }
  ]
}
'

The resulting response payload should look something like this:

{
  "lead": {
    "remoteId": "0000000000000000000",
    "leadOwner": "005Hs00000CAYV1IAP",
    "leadSource": "Inbound",
    "leadTitle": null,
    "company": "Alloy",
    "firstName": "Kelly",
    "lastName": "Gold",
    "addresses": [],
    "emailAddresses": [],
    "phoneNumbers": [],
    "remoteCreatedAt": "2023-11-19T17:00:17.000Z",
    "remoteUpdatedAt": "2023-11-19T17:00:17.000Z",
    "remoteDeleted": false,
    "createdAt": "2024-02-22T11:17:53.264Z",
    "updatedAt": "2024-02-22T13:54:03.445Z",
    "id": "b8f78a04-b00d-4192-ba4f-935a72ac6b4d"
  }
}

You can also use the GET List Leads endpoint and filter by unique identifiers like Id or emailAddress to check for existing records and avoid the creation of duplicates. Once the lead is created in the user’s CRM, they can set up routing based on their own criteria for lead distribution — dividing leads between reps by territory, for example.

3. Notify the user's sales team

There are a couple of routes we can take here, depending on whether follow-up tasks are automatically created for inbound leads in your application.

If a follow-up task hasn't been created, major CRMs like Salesforce and HubSpot have built-in automation functionality that can be used to notify reps of new leads that require follow-up.

If a follow-up task has already been created in your product, you can sync it to the user’s CRM and associate it with the correct lead record — Alloy's common model supports tasks.

Use the POST Create Task endpoint to assign a follow-up task, complete with a description. The request should look similar to this:

curl --request POST \
     --url 'https://embedded.runalloy.com/2023-06/one/crm/tasks?credentialId=CREDENTIAL_ID' \
     --header 'Authorization: Bearer YOUR_API_KEY' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "taskSubject": "Email",
  "taskContent": "inbound follow-up"
}
'

The response payload will look like:

{
  "task": {
    "remoteId": "00THs0000D57fPNMQY",
    "taskSubject": "Email",
    "taskContent": "inbound follow-up",
    "taskOwner": "005Hs00000CAYV1IAP",
    "taskOpportunity": null,
    "completedDate": null,
    "dueDate": null,
    "taskStatus": "Not Started",
    "remoteCreatedAt": "2023-11-19T17:00:17.000Z",
    "remoteUpdatedAt": "2023-11-19T17:00:17.000Z",
    "remoteDeleted": false,
    "createdAt": "2024-02-22T11:17:53.264Z",
    "updatedAt": "2024-02-22T13:54:03.445Z",
    "id": "eea53606-ac0d-43b6-a9c7-f233844bbe0c"
  }
}

Help your users convert more leads

By enabling your users to follow up with leads quickly, you drastically improve their chances of conversion (as well as your product’s contribution to their pipeline.)