Lead assignment to sales representatives
  • Updated on 20 Jul 2020
  • 6 minutes to read
  • Print
  • Share
  • Dark
    Light

Lead assignment to sales representatives

  • Print
  • Share
  • Dark
    Light

In this tutorial, we take a more practical perspective and look into how to use Aito in high-speed lead qualification process.

Before you begin

Getting an Aito instance

If you want to follow along with this tutorial, you'll have to go and get your own Aito instance from the Aito Console.

  1. Sign in or create an account, if you haven't got one already.
  2. In the Aito Console go to the instances page and click the "Create an instance" button.
  3. Select the instance type you want to create and fill in needed fields, Sandbox is the free instance for testing and small projects. Visit our pricing page, to learn more about the Aito instance types.
  4. Click "Create instance" and wait for a moment while your instance is created, you will receive an email once your instance is ready.

If you're totally new to Aito the get started guides might be useful before reading this tutorial.

Accessing instance details

After the instance creation is ready, you can access the URL and API keys of the instance by

  1. Log in to Aito Console
  2. Click on the instance your created
  3. Go to the overview page. You can copy the API keys after clicking the eye icon.

api_info

Get the Aito Command Line Interface tool

  1. Get the Aito CLI tool if you don't have it yet (you'll need Python3.6 or higher installed)
pip install aitoai
  1. Configure the CLI using the instance URL and read/write API key.
aito configure

Use case: Assigning leads to sales representatives

According to the lead response management study the key to getting in contact with a lead is speed. The leads were collected through a web form and at least one attempt was made to call the lead. They found that, if you wait for 30 minutes vs. under 5 minutes until trying to reach the lead the odds of contacting them go down 100 times and odds of lead qualification drop 21 times.

To hit this 5-minute window, Intwixt built the DealFlow Slack app. Intwixt DealFlow empowers companies to do real-time lead qualification and assignment while not leaving their favorite communication environment. Dealflow also embeds NLP (Natural Language Processing) to do analysis and get additional information through natural language input directly in the respective team communication app (Slack, etc.).

Aito was integrated into DealFlow's recommendation engine to help with making intelligent recommendations on who to assign to an incoming lead. The engine assists the sales manager to make faster decisions and shortens the time to contact a lead, which is critical for sales.

Aito works in the background of selecting the correct sales rep to take the incoming lead.

Data

Intwixt DealFlow collects data from Slack, Hubspot, and Intercom. From the sources, it creates a company information table to Aito and adds the information of which sales rep was assigned to the lead. DealFlow customers can also request their own proprietary information to be added to the data sources. In Aito, the table could look like the following.

Sales reps table (example)

number_of_employees country company_revenue_last_year business_type sales_rep_id company_type
100 Sweden 3000000 B2B 435 software
340 Austria 5230000 B2C 761 hardware
2600 China 12400000 B2B 435 hardware
... ... ... ... ... ...

Overview

The workflow will consist of two steps:

  1. Upload data into Aito.
  2. Assigning a sales rep to a lead.

#1 Upload data

  1. Download the example dataset from here.
  2. Upload data using the quick-add-table feature in the Aito CLI
aito quick-add-table --file-format csv --table-name company_info lead-qualification.csv

#2 Assigning a sales rep to a lead

Query

The predict endpoint can be used to find the most suitable sales rep for an incoming lead.

curl -X POST \
  $AITO_INSTANCE_URL/api/v1/_predict \
  -H "content-type: application/json" \
  -H "x-api-key: $AITO_API_KEY" \
  -d '{
      "from": "company_info",
      "where": {
        "country": "United States of America",
        "company_type": "software",
        "company_revenue_last_year": {"$numeric": 50000000},
        "number_of_employees": {"$numeric": 200000000},
        "business_type": "B2B"
      },
      "predict": "sales_rep",
      "select": ["field", "feature", "$p", "$why"]
    }'

The from clause defines the table we're using for the prediction. Resembles FROM in SQL.

The where clause defines the prior information we have on the incoming lead by using propositions, e.g. company_type: software. The operator $numeric should be used to signal Aito that a numeric value behaves like a continuous number, instead of behaving like a categorical value or an identifier.

In the predict clause we define the column for which a value should be predicted for, in this case it's the sales_rep column.

In the selectclause we can define which operators we want to be returned in the result. By selecting $why we can also get the reason why would a certain sales rep be the best for the lead. In the select clause field, feature and $p will return the respective values in the response, if you wouldn't use the select clause, then field, feature and $p would be returned by default.

Result

{
  "offset": 0,
  "total": 14,
  "hits": [{
	"field": "sales_rep",
	"feature": 121,
	"$p": 0.9729960314914861,
	"$why": {
		"type": "product",
		"factors": [{
			"type": "baseP",
			"value": 0.02911275415896488,
			"proposition": {
				"sales_rep": {
					"$has": 121
				}
			}
		}, {
			"type": "product",
			"factors": [{
				"type": "normalizer",
				"name": "exclusiveness",
				"value": 1.3099958077384477
			}, {
				"type": "normalizer",
				"name": "trueFalseExclusiveness",
				"value": 1.0421808983075453
			}]
		}, {
			"type": "relatedPropositionLift",
			"proposition": {
				"country": {
					"$has": "United States of America"
				}
			},
			"value": 25.846669840492936
		},
    ...
},
...

In this example the sales rep with the ID 121 would the best for the case with the probability ($p) of ~97%. The operator $why can give us more information on why sales rep 121 would be the best one to handle the incoming lead.

The object baseP gives us the base probability of the sales rep being 121, so if you would randomly choose a row from Aito what would be the probability of the sales rep field having the value 121. The base probability gives us an idea that how specific the prediction probability $p is. In this case the baseP is very low (0.03) and the $p is high (0.97), so we can deduce that there is something special why the sales rep 121 would be good for this specific lead.

Aito uses the normalizer objects internally and for most use cases the values can be ingnored.

The relatedPropositionLift object tells us how other propositions are related to the result, i.e. how the $p value can be explained. From the $why result, we can see that the incoming lead's country improves the odds (value is over 1) of 121 being the correct sales rep by a factor of 25.8, which probably means that the sales rep 121 has managed most of the leads that are based in the US.

What's next

In Intwixt's dealflow when a sales rep has been selected for the lead, the information is appended to the company information table and used in the future predictions. This way the predictions are always kept up-to-date with no extra model teaching steps.

For future improvement if we would have the definition of success of lead qualification for a sales rep, e.g. lead turned into a customer, the information could be used to further improve the model. With the added success information we could use the value as a goal and start using the recommend endpoint.

Creating your own prediction pipelines

If you're interested in making your own predictive pipelines using Aito, contact us at hello@aito.ai and tell us about your use case and we can see how we can help to bring your ideas to life! Or request for an early access through our landing page.

Was this article helpful?