How to Build an AI Sales Development Representative (SDR) in Slack - Part 5: HubSpot CRM Integration
Introduction #
In this fifth part of our AI SDR series, we'll enhance our AI sales assistant with HubSpot integration and multi-platform campaign execution capabilities. By the end of this guide, your AI SDR will be able to handle the entire process from lead generation to campaign creation across both Smartlead and log these leads in HubSpot.
This guide is Part 5 of a six-part series for how to build your own AI SDR (Sales Development Representative) in Slack. This template includes the code from Parts 1-4 and the subsequent guides are linked at the bottom of this post.
Getting Started #
To begin enhancing your AI sales assistant with HubSpot integration and multi-platform campaign execution capabilities, fork this template by clicking "Use Template" below:
HubSpot Private App Key
Log in to your HubSpot account and go to Settings > Integrations > Private Apps.
Click Create a private app and give it a name.
Set the required scopes (you'll need access to deals, contacts, companies, and owners). For this app you will need to give the following scopes:
crm.schemas.contacts.write
crm.schemas.contacts.read
crm.schemas.custom.read
crm.schemas.custom.write
crm.schemas.companies.read
crm.schemas.companies.write
crm.objects.goals.read
Click Create app and you'll receive a private app access token.
In Replit, add this token to the Secrets tab as HUBSPOT_API_KEY.
Breaking Down the Enhanced AI Sales Assistant Code #
Let's explore the key components that make our AI SDR a more powerful tool for lead generation, qualification, email sequence generation, and multi-platform campaign execution:
HubSpot Integration
We've added a new function in utils.py to handle the upload of leads to HubSpot:
This function handles the process of uploading leads to HubSpot, ensuring that we respect API rate limits and handle potential errors.
Multi-Platform Campaign Execution
We've updated the post_final_email_sequence function in main.py to handle campaign execution across both Smartlead and HubSpot:
This function now handles the uploading leads to both Smartlead and HubSpot, and provides a summary of the actions taken across both platforms.
Deploying Your AI SDR #
In order to keep your AI SDR running 24/7 and receive requests whenever someone mentions it in Slack, you'll need to deploy it on a hosted server.
Open a new tab in the Workspace and search for “Deployments” or open the control console by typing ⌘ + K (or Ctrl + K) and type "deploy". You should find a screen like this.
For bots like this that need always need to be up listening to requests, we recommend using a Reserved VM. On the next screen, click Approve and configure build settings most internal bots work fine with the default machine settings but if you need more power later, you can always come back and change these settings later. You can monitor your usage and billing at any time at: replit.com/usage.
On the next screen, you’ll be able to set your primary domain and edit the Secrets that will be in your production deployment. Usually, we keep these settings as they are.
Finally, click Deploy and watch your bot go live!
What's Next for Your AI Sales Assistant #
With these enhancements, your AI SDR is now a comprehensive tool for lead generation, email address enrichment, email sequence generation, and CRM syncs. In the next part of this series, we'll be adding the ability for the assistant to add your leads and into your HubSpot CRM. The other parts of the series include:
- AI SDR - Part 1 - Lead List Creation
- AI SDR - Part 2 - Lead Enrichment
- AI SDR - Part 3 - Draft Email Copy
- AI SDR - Part 4 - Create Smartlead campaign
- AI SDR - Part 5 (this guide) - Add Leads to HubSpot
- AI SDR - Part 6 (Final) - Agent Mode
If you'd like to discuss how to enable your team to build and implement tools like these, feel free to schedule some time with the Replit team for a quick demo of our product.
Happy coding and selling!