Giter Club home page Giter Club logo

Comments (6)

acoumb avatar acoumb commented on August 10, 2024 1

@bjarnef yes, it is refreshed when an Unauthorized response is retrieved from HubSpot.
I have released a new version of the package here adding constant values.
Let me know if there is anything else I can help you with.

from umbraco.cms.integrations.

bjarnef avatar bjarnef commented on August 10, 2024

Btw. is it possible to possible from a form guid or does it need to entire HubSpotForm model? E.g. it passing in form guid to a Vue component.

E.g. there is a help to render the selected Hubspot form:

@Html.RenderHubspotForm(Model.HubspotForm)

But can we render it from a known Guid?

var guid = Guid.Parse("9ac95f04-a658-467d-936f-4b0a726eb3ca")
// Render Hubspot form

or

var guid = Guid.Parse(Model.HubspotForm.Guid)
// Render Hubspot form

Currently we have a project using a Vue component where form guid (hardcoded) is passed into an API Controller method like this:

[HttpGet]
public HttpResponseMessage getForm(string formId)
{
    string hubspotApiKey = "something-secret";
    string url = string.Format("https://api.hubapi.com/forms/v2/forms/{0}/?hapikey={1}", formId, hubspotApiKey);

    using (WebClient wc = new WebClient())
    {
        var json = wc.DownloadString(url);
        var jObject = JsonConvert.DeserializeObject<RootObject>(json);

        var response = Request.CreateResponse(HttpStatusCode.OK, jObject , "application/json");
        return response;
    }
}

@acoumb maybe you know how something equivalent could work with the integration package? Is is only possible to fetch the form as HTML or as JSON like the code above?

from umbraco.cms.integrations.

acoumb avatar acoumb commented on August 10, 2024

Hi @bjarnef
When HubSpot introduced the EU data centers, this affected the form rendering of the forms. To support both scenarios the view model passed to the view contains the source of the JS script as well as some mandatory fields for HubSpot to initialize the JavaScript objects: region, portal ID and the form ID.
Does this answer your question?

from umbraco.cms.integrations.

bjarnef avatar bjarnef commented on August 10, 2024

Hi @acoumb

Okay, is it still possible to fetch the JSON as today, but it seems starting November 30, 2022, HubSpot API keys will no longer be able to be used as an authentication method to access HubSpot APIs as used in #48 (comment)

https://developers.hubspot.com/docs/api/developer-guides-resources
https://developers.hubspot.com/docs/api/migrate-an-api-key-integration-to-a-private-app

Currently it seems the Vue component fetch e.g. portal from the mentioned API method and render to from JSON using vue-json-schema-form:
image

It seems this it currently using "v2" https://legacydocs.hubspot.com/docs/methods/forms/v2/get_form but I noticed there's also a newer "v3" : GET /marketing/v3/forms/{formId}
https://developers.hubspot.com/docs/api/marketing/forms

I haven't looked into if there are differences in response in "v2" and "v3", but both can be authorized using OAuth Access Token or API Key - but I guess it is the API Key approach which will stop working.

image

https://developers.hubspot.com/docs/api/developer-guides-resources

from umbraco.cms.integrations.

bjarnef avatar bjarnef commented on August 10, 2024

@acoumb regarding the access token saved to the database https://umbraco.com/blog/integrating-umbraco-cms-with-hubspot-forms/ is this refreshed when expired? From what I understand it previous expired after 6 hours, but it seems to have changed to 30 minutes? https://developers.hubspot.com/changelog/upcoming-expiration-of-oauth-access-tokens-is-changing

It seems the "old" way using hapiKey query parameter then need to send access token in Authorization header instead:
https://developers.hubspot.com/docs/api/migrate-an-api-key-integration-to-a-private-app#update-the-authorization-method-of-your-integration-s-api-requests

from umbraco.cms.integrations.

bjarnef avatar bjarnef commented on August 10, 2024

Great, I think we can close this issue then.
For this project the client chosen to go with a private app to request the forms using then access token as it otherwise required a bit more work to first upgrade to Umbraco 8.5.4+

from umbraco.cms.integrations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.