Build Hubspot Integration using GibsonAI
GibsonAI can build integrations. The post focuses on integrating Hubspot with a custom application. The goal is to extract all companies that were created as leads in the past 48 hours from HubSpot and store them in a local database. This will help build a comprehensive company profile. We’ll begin by creating a table named company by using GibsonAI data modeler.
Step 1: Setting up directory structure
>gibson dev on
To kick things off, we need to instruct Gibson AI on where to write the code. It also automatically creates three folders: API, Model, and Schema.
Step 2: Data Modeling
>gibson code entity company
The command launches the Gibson Data Modeler. User can ask Gibson to add additional attributes: name, location, and industry. While Gibson AI offers robust capabilities to develop sophisticated data models, we’ll keep it simple for now.
Step 3: Code Generation
>:w
One of the standout features of Gibson AI is its ability to quickly generate code. By typing :w, Gibson AI writes out the code, including API routes, base models, schemas, tests and deployment files all within seconds.
Step 4: Building the Data Store
>gibson build datastore
The command builds the tables in the database based on entities in memory. And it's blazing fast!
Step 5: Invoking the Gibson AI Agent
Our objective is to build an integration that extracts companies created in the past 48 hours from HubSpot and inserts them into our database, create in step 4. For this task, we invoke the Gibson AI agent, which will guide us through the integration process. It asks for the path where the code should be written.
Step 6: Defining the Task
The agent then asks for details about the task. This expects a free form natural language description that continues into a chat style experience.
Step 7: Task completion
Gibson AI analyzes the task and generates a comprehensive plan. It writes the code to the console, performs a security review, and identifies areas for improvement. The agent creates the integration & configuration file to store database connection details and the HubSpot access token.
Step 8: Running the Integration
The script successfully inserts 100 customers into the database within minutes. In less than 8 minutes, we built a data model, implemented the tables and wrote a hubspot integration. More importantly, everything complied and executed right away!