HubSpot Company Properties List

Here is a lookup table of HubSpot’s default company properties.

  • name: the internal name for data analysis, which is like variable name in a data frame;
  • label: the label name on HubSpot platform, which is easy to remember;
  • description: more information about a property;

Feel free to use it but please be aware that these are just the default company properties from my test developer account. As such, please check HubSpot API if you want to have a full list of all your properties.

Continue reading

Transform List into Dataframe with tidyr and purrr

As a data structure in R, list is not as familiar to me as vector and dataframe. I knew that list is often returned by function calls but I didn’t pay much attention to it until I started working on the API wrapper package RLeadfeeder. It turned out that list can be very useful to hold all kinds of data returned from API platforms and I had to make an effort to learn how to work with it, namely extract useful elements from a list and turn them into a dataframe.

Transform Lists into Data Frames in R
Transform List into Data Frame in R

This post is an example of how to transfrom a list into a dataframe with two different approaches: tidyr and purrr. The packages used in this post are as follows:

Continue reading

Another Quadratic Programming Example with R

Following Quadratic Programming with R, this is another example of how to solve quadratic programming problem with R package “quadprog“.

Why Another Example?

Quadratic programming matrix math notation
quadratic programming matrix notation

quadprog” package requires us to rewrite the quadratic equation in the proper matrix equation as above. You may have the following questions:

  • What if our equation is to maximize the objective function instead of minimize it?
  • What if the inequality constraints are “less than (<=)” instead of “more than (>=)”?
  • What if there is no equality constraints?

To give you an idea how to answer these questions, this post will give you another example.

Continue reading

httr Two Common Authentication Methods

What I just learned that there can be a couple of authentication methods used in R API wrapper packages but the most common ones are API Key and OAuth 2.0.

API Key

API Key normally can be generated on a developer dashboard and can be regenerated later for security reason.

API Key can be saved as an environment variable in a .Renviron file and then we can use Sys.getenv() to get access to it, as shown here: https://github.com/maelle/goodpress/blob/main/R/utils-http.R.

keyring package is another common way to manage API Key: key_set() to create api key and key_get() to get access to the api key, as shown here: https://github.com/lockedata/hubspot/blob/master/R/hubspot_key.R.

Lastly, there are two different ways to include an api key in api calls: including it as part of the URL or adding it in the HTTP header.

Continue reading

HubSpot Contact Properties List

Here is a lookup table of HubSpot’s default contact properties.

I have been working on HubSpot data analysis with R on a daily basis and having a good understanding of contact properties can save me a lot of time. HubSpot provides the properties CRM api for developers to get the contact properties list and also provides the explanations of all the default contact properties: https://knowledge.hubspot.com/contacts/hubspots-default-contact-properties.

Continue reading