Hello. I am new to Hubspot development.
I was wondering, what would be the best approach to creating a module on our Hubspot page that would pull a company address and then display it on a small map on our page? I did get an API key for Google Maps.
Right now I am able to pull the contact information, but I would like to use it to display a small map on a widget on our page. I know there are off-the-shelf solutions such as Geomap, but we would prefer to use our own free solution.
I would like to know if this is even possible or will this be difficult?
Hey, @ChrisSosa1337
Thanks for reaching out! This sounds like a great project. My instinct is this is at or around an intermediate level of technical sophistication.
The first step is to list out all the pieces we’ll need. If it were me, here’s how’d I tackle it (full disclosure, I haven’t built this exact module):
Create a custom module
- You’ll need to create a Custom Module in the Design Manager to hold your Google Map embed script
Query or input the address
- how are you “pulling” the company address?
- Will a User input the company name? Will this be on a static page for a company?
Handling security
- do you have middleware of some sort? A server and app to make the API calls and securely handle your auth tokens and secrets. I would strongly advise against making API calls that contain security keys from the browser
Converting the address to the coordinates Google Maps requires
- once you grab the address, you’ll need to make a call to the Google Maps Geocoding API to convert the retrieved company address into geographical coordinates (latitude and longitude)
Google Maps JavaScript API
- use the Maps JavaScript API to convert the geographical coordinates
- customize the map as needed
Add the script to your module
Reviewing this, it’s not fast or easy, but you will end up with a custom module that will work to your exact specifications. It’s likely a weekend project to get an ugly proof of concept built out. And only you can determine whether using something off the shelf that may be “good enough” but gets you moving forward is sufficient. Or do you have time and resources to build something custom?
Have fun building! — Jaycee