💬 RevOps Discussions

thesnappingdog
Contributor

Hubspot API Scripts - What do you script when the UI fails you?

Hi all, 

 

I'm really curious to hear what kind of scripts do you use through the Hubspot API and for what purpose.

 

Hubspot is an awesome tool, and many things have been made very easy 🙂 However, there are some tedius operations that cannot be done in bulk, and doing them manually is frustrating and feels like a waste of time. 

 

Luckily the API and its documentation is really good, so I started writing scripts to get rid of some things. I've used the API for things like:

 

- Mass update all of our forms through a template form

- Mass clone & edit marketing emails from a template email + .csv data

- Mass delete contact workflows 😂

- copy a set of contact / company properties from a development portal into production

- update all blog articles with a new tag_id

 

If it's useful to anyone, I have a public repository for my hubspot scripts that I update from time to time. 

 

I also wrote a step-by-step for mass updating your hubspot forms with a script.

 

- Github repository

- Walkthrough for form update script

0 Upvotes
3 Replies 3
adanielson
HubSpot Product Team
HubSpot Product Team

Hubspot API Scripts - What do you script when the UI fails you?

@thesnappingdog  thanks so much for sharing-- this repo is awesome! If you ever want to share this outside of this Power User Community, we have a Share Your Work board of the HubSpot Developers forum that this would be a great fit for (if you haven't shared there already!)  https://community.hubspot.com/t5/Share-Your-Work/bd-p/designers_bestpractice 

I wrote a Python script to get all contacts with more than one email address, with the overall goal being to detect & fix contacts that were overwritten by form submissions  or from emails being forwarded between contacts. It then identified the oldest (original) email address for those contacts, and returned that value.

 

I didn't get to build out this next part, but ideally it would have then deleted the other email addresses on the contact besides the original. But now we have this endpoint in developer preview, https://developers.hubspot.com/docs/methods/contacts/get-secondary-email-addresses-by-vid which made a lot of what I wrote obsolete/overcomplicated 🙂 -Amanda Danielson, HubSpot Success Consultant

0 Upvotes
cooperelias
Contributor

Hubspot API Scripts - What do you script when the UI fails you?

@adanielson - This sounds like it's probably beyond my capabilities anyway, but how were you able to get all contacts with more than one email address?

 

Also, thanks for linking to that developer preview endpoint...I hadn't see that yet!

0 Upvotes
adanielson
HubSpot Product Team
HubSpot Product Team

Hubspot API Scripts - What do you script when the UI fails you?

Hey @cooperelias ! Here is the repl.it for how I did it originally just using the contacts API.https://repl.it/@AmandaDanielson/Clean-Overwritten-Contacts It writes the original addresses for each contact with duplicates to first.csv, and all overwrites to overwrites.csv

0 Upvotes