doubleyougtt / hubspot Goto Github PK
View Code? Open in Web Editor NEWR package 📦 for working with Hubspot 👩💼👨💼 data
Home Page: https://itsalocke.com/hubspot/
License: Other
R package 📦 for working with Hubspot 👩💼👨💼 data
Home Page: https://itsalocke.com/hubspot/
License: Other
https://developers.hubspot.com/docs/faq/subscribing-to-api-updates
What I'd really like is an issue posted to this repo for each new release.
mutate_if(~ sum(is.na(.)) == sum(is.na(suppressWarnings(as.numeric(.)))), as.numeric)
In particular, Hubspot APIs with an s.
Pro: useful
Contra: a looot of URLs that CRAN would check.
Taking notes here as I go, then this will go to CONTRIBUTING.md in a polished form.
create dev account https://app.hubspot.com/signup/developers
confirm email address by clicking on email received shortly afterwards
create test account from there
Opening a new issue mainly to not clutter #2
https://developers.hubspot.com/docs/methods/oauth2/get-access-and-refresh-tokens
"Access tokens expire after 6 hours, so you can use the refresh token to get a new access token when the first access token expires. "
https://academy.hubspot.com/courses/introduction-to-hubspot-apis
In particular, it'd be grand if it helps me understand and document accounts.
I don't intend to follow it carefully, just to check it out.
get_results()
How do we name raw getters and functions returning tidy output?
One solution by Steph
raw_deals<-raw_all_deals()
deal_props <- tidy_all_deals(raw_deals, view = "property_versions")
deal_associations <- tidy_all_deals(raw_deals, view = associations")
Seeing that I'm wondering whether all raw getters should return a R6 object that's not much different from a list except it has tidy() methods that depends on the function that created it. But maybe get_deals()$view("associations")
is not an intuitive syntax. It could also be get_deals()$associations()
or so to take more advantage of tab-autocompletion.
I wonder whether there should be one R script by entity.
Currently the default OAuth app asks for a lot of different scopes including e.g. content that's only available to marketing professional or enterprise account. https://developers.hubspot.com/docs/methods/oauth2/initiate-oauth-integration?_ga=2.118505865.1889963731.1575269876-1134397846.1571640267#scopes
I suppose we should keep only the scopes that are available to any account (contacts, forms) as compulsory scopes and make the other optional + error well when they're not available.
well not really but adding a sentence and a link.
https://developers.hubspot.com/docs/crm-integration-guide/overview
(if I follow correctly)
@stephlocke is it expected that deal_associations()
returns 0 row?
What it is https://github.com/jpetrucciani/hubspot3#rate-limiting
How to automatically use ratelimitr
based on the API key (see if there's an endpoint returning your plan)
They're failing at the moment, from a quick look it seems the data returned by the API changed.
Related to #4
In particular, why does it comment several times on each problematic commit.
On Stack Overflow @stephlocke do you do that in general for your packages?
On the Hubspot forum itself.
Not urgent, but eventually it'd be nice to have.
Avoid lots of calls to the Hubspot API and make it easier to pass CRAN by tests being quicker by using {mockr} etc
Make sure the repo has all the right labels etc
Check repos like HIBPwned to see what's what, read Harmonising and emojifying our github repos, and when in doubt consult with @maelle!
Currently, API keys are plaintext arguments to functions. This isn't great, we should enable folks to store these like other important credentials e.g. tic.
what is it useful for
probably to be memoised
https://developers.hubspot.com/docs/methods/get-account-details
When a user (owner) is deactivated in HubSpot they are not removed from deals as the owner. This can cause downstream issues. It would be useful to be able to set the "includeInactive" property on the hubspot api call (owners/v2/owners) when calling getOwners.
If so, save it as environment variable on Travis and see https://github.com/khufkens/ecmwfr/blob/cb82af27e8b69524784d13a94855d86317ce2e93/tests/testthat/test_ecmwf.r#L2
Find and doc.
At the moment
#' @import purrr
#' @import dplyr
#' @import tidyr
Long term but making examples dontrun right away is a good choice (but make pkgdown build them)
Examples probably in dontrun (cf https://stat.ethz.ch/pipermail/r-package-devel/2019q4/004483.html), tests possibly all skipped on CRAN.
The set_renv()
function is returning weirdly for me. The below file path is the one generated in the token create function.
> set_renv("HUBSPOT_PAT" = "C:\\Users\\steph\\OneDrive\\Documents/.hubspot_token1.rds")
> Sys.getenv("HUBSPOT_PAT")
[1] "C:UsersstephOneDriveDocuments/.hubspot_token1.rds"
I just hot fixed the parameter for get_contacts()
. It seems that the incorrect label of properties
was being added, not property
. All the other getters with functions should be checked for the same issue.
Help people see how the package hangs together by showcasing some basic analysis of the demo data.
Amend initial vignette
If all goes well I'll have a big table of methods and params which should help knowing where to define params to have them inherited.
Maybe there could be one false function not exported but documented that just exists to document all params in one place.
I see some v1 in the docs, some v2 in the code.
If that one failed and the other not, it'd mean the data from the API is different.
not caught by tests though
library("hubspot")
get_companies()
companies <- get_companies()
companies
Once it is a bit more mature, obviously.
I don't know whether it's even possible to have it listed there but it'd be great.
We need issues filed that will help people start developing functions for the Hubspot API.
For each category e.g. deals, we need to identify any relevant get_
functions needed and any view functions over the top of the gets. So far for deals, companies, and pipelines I've done some work and used gets for each entity type. Some gets had very simple responses like deal properties so did not need further manipulation, but many need multiple functions for extracting different slices of data in a tabular way.
Each issue should provide instructions for:
As well as #1 enabling better storage of API keys we should also enable oauth access.
Pretty sure I know some / most of the reasons why, but thought maybe asking the question could surface some valuable considerations / responses (both for this use case and others like it).
Given the relative ease with which one can use reticulate
to call Python functions from R, why not rely on a Python package like hapipy or hubspot3 to retrieve data rather than creating an R package?
i.e. Assuming that (a) the end goal is to retrieve data via an API and use it in R, and (b) a Python API client library exists but no R API client library exists; when should one go to the effort of creating an R API client library?
Maybe they're ok to simply suppress.
hubspot::deal_properties()
#> Warning in .p(column, ...): NAs introduced by coercion
#> Warning in .p(column, ...): NAs introduced by coercion
#> Warning in .p(column, ...): NAs introduced by coercion
#> # A tibble: 1 x 19
#> dealId dealname hs_all_accessib… amount closedate
#> <dbl> <chr> <chr> <dbl> <dttm>
#> 1 9.32e8 Example… "" 100 2019-08-02 23:58:38
#> # … with 14 more variables: num_associated_contacts <dbl>,
#> # hs_all_team_ids <chr>, createdate <dttm>,
#> # amount_in_home_currency <dbl>, days_to_close <dbl>, pipeline <chr>,
#> # hubspot_team_id <chr>, hubspot_owner_id <dbl>,
#> # hs_lastmodifieddate <dttm>, hubspot_owner_assigneddate <dttm>,
#> # dealstage <chr>, hs_createdate <dttm>, hs_object_id <dbl>,
#> # hs_all_owner_ids <dbl>
Created on 2019-10-21 by the reprex package (v0.3.0)
Maybe also in an automatic way cf #3
What rights does an user need to be able to create an API key, and a OAuth token?
cc @jonmcalder
Should we add an user agent, that'd identify this package, maybe with its version?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.