Using AI for ABM
Overview:
A few months ago, I helped publish a playbook on Hightouch's blog about an internal tool we built that would leverage AI to automate account research for our sales team. I wanted to write a more in-depth post on my personal substack with more technical and architectural details. I also wanted to share some of the honest challenges and learnings of building this.
AI is a fad right now, and depending on which side of the tech hipster spectrum you reside in, you're either entirely on board or annoyed by seeing the acronym. I'm somewhere in the middle, but I believe in practicality. I get excited about the idea of adding a new tool, especially something as powerful as AI & LLMs, to my arsenal for GTM problem-solving, but not just for the sake of it, and I wanted to wait for the exemplary scenario in which I felt it could add business value.
To contextualize the problem we were solving, we were internally deploying an account-based marketing pilot. TLDR on what account-based marketing or ABM means is spending a highly concentrated (cross-functional) effort on a specific set of target accounts (No AI was used to construct this definition). You can think of it as doing a bunch of typically unscalable efforts against a set of accounts that we believe to be the best fit. In deploying this effort/pilot, we quickly uncovered that the most significant risk was the effort we needed from the sales team to make this motion effective. They needed to spend considerable time prospecting and researching these accounts. As someone classified as Revenue Operations by trade, my role is to optimize their time and automate their processes where I can so I tried to see where I can help derisk here. I hosted a brief discovery call to try to understand which portion of prospecting these accounts was the most significant time suck, and my findings were "Account Research."
Sales reps will look into anything from executive podcasts to public filings to try and get a sense of the challenges and priorities within a given account and try to tie our company's value prop to those challenges & priorities. This was a perfect scenario in which I could deploy AI to automate some of this work, with the only requirement being the final result ending up somewhere within our sales rep's day-to-day workflows.
The solution blossomed into us sending a list of accounts to an AI API and sending the results to Salesforce. Fortunately, I work at Hightouch, and I can handle the sending/triggering of the API request and the response sending to Salesforce with Hightouch.
Leveraging our internal product and some unofficial AI APIs, I built a workflow that would intake a list of accounts, search public documents and public information, and write a summary back to Salesforce on current challenges & priorities.
Now, let's get to the fun part.
How it works:
This is essentially how it worked
Isolate accounts in the data warehouse
Send Accounts to serverless function via Hightouch
Ping an AI API and use account details within the prompt
Write the response back to the data warehouse
Have a Hightouch sync pump the response into Salesforce as a note.
Step-by-Step Guide:
Isolate accounts in the data warehouse.
There are a few ways to do this, but we need a way via SQL to isolate these accounts from others. The easiest way is to create a dummy checkbox that could be added in Fivetran and synced to the data warehouse. Alternatively, a cleaner way is to use accounts in a Salesforce campaign that you can join against so that you do not need to create a fake property that will never be used.
Here is my SQL snippet:
select
account_id,
account_name,
clean_website
from Salesforce.campaign_members
left join Salesforce.accounts on member_id = account_id
where campaign_id = 'xyz'
Send Accounts to serverless function via Hightouch.
With Hightouch, sending data and a row of data to a serverless function is straightforward. In my novice developer brain, I could best describe a serverless function as if you press a button and a script runs. There are several ways to trigger. Serverless functions, but Hightouch makes it easy to select a schedule for when to look for new/changed rows to send to this function. In this example, if a new row is returned in our query, it will send the row with all the columns to this script to be ran whenever a new account is added to the campaign.
In the future state, we would want to refresh this data from time to time, so I would do something like join against a date table so that whenever the fiscal quarter changes, we would rerun the model. Hightouch's diff functionality would rerun every time a column changes.
Using Hightouch for the trigger makes it easy to build out a schedule + handles things like rate limits and error handling.
Ping an AI API, use account details within the prompt, and write the response back to the data warehouse.
First, I'm sure there are 100 different APIs you can use now for this, but I elected one that was easy for me to use ( again, novice developer) and an LLM with up-to-date data as we are looking to reference current events. Here is the unofficial bard API I used: https://github.com/dsdanielpark/Bard-API.
I'll walk you through the code snippet below.
This snippet runs once per row that Hightouch is sending over. The row is sending pretty much every field from a Salesforce account. In this elementary version, I will just use the company name as a variable in the prompt; however, there are a million different use cases where other salesforce information would be valuable.
I am first storing the account name (which will be used in the prompt) and account ID (this will be useful for writing back to Salesforce).
Next, I'm following the API parameters and providing my session token + a prompt with a row-specific variable.
Our prompt was simple in that we just asked to summarize the marketing paint points of {[COMPANY}} based on 10k filing or other public information.
I then store the response.
After receiving the response, we insert that into a snowflake table along with the Account ID. In future states, we would also have a key such as {{ACCOUNT_ID-FISCAL_QUARTER}} or something like that.
I had to do a bit of cleaning before inserting it into Snowflake, as it required a specific format.
import pandas as pd
import requests
from bardapi import Bard
import bardapi
import snowflake.connector
def bard_enrinch(response):
response = response.get_json()
print(response["ACCOUNT_NAME"])
account_name = response["ACCOUNT_NAME"]
account_id = response["ACCOUNT_ID"]
token = 'bardsessionn token'
bard = Bard(token=token)
input_text = "Summarize the marketing pain points of {} based on their latest 10k filing or other public infomration".format(account_name)
ai_response = bardapi.core.Bard(token).get_answer(input_text)
print(ai_response["content"])
ai_response = ai_response["content"]
conn = snowflake.connector.connect(
account= "accountid",
user= "username",
password= "pw,
database= "Reporting",
schema= "ANALYTICS")
cursor = conn.cursor()
ai_response = ai_response.replace("'", "").replace(",", "")
ai_response = str(ai_response)
account_id = account_id.replace("'", "").replace(",", "")
account_id = str(account_id)
print(account_id)
cursor.execute("""insert into analytics.testing.acct_mktg_painpoints_test values ('{}', '{}')""".format(account_id, ai_response))
return "Done
This is what our snowflake table looks like:
Have a Hightouch sync pump the response into Salesforce as a note.
Now that we have a table with Account ID and AI response, we can then send that anywhere downstream with Hightouch, but we elected to use the salesforce note object as that would be most accessible for the reps. I just created a model in Hightouch and select * from our table with the responses. Hightouch will detect any time there is a new row and will insert it into Salesforce.
The Sync Config is relatively simple.
Final Output + Conculsion:
As you can see in the final output screenshots below, AI summarized a very exhaustive summary based on 10k and provided some ways Hightouch could offer a solution.
The output was slick and opened the door for many different use cases since we already have the architecture in place.
One of the biggest challenges we ran into was that the LLM ALWAYS HAD AN ANSWER even for private companies. This is consistent with my other experience using Chatgpt or Bard in that it sometimes "makes stuff up" and would reference nonexistent 10ks and public documents in this scenario. I was still pretty happy as it helped our reps and increased the likelihood that they would reach out to these accounts, but in the longer term, it's essential to keep this in mind.
I would love to hear how others are leveraging AI.