Search code examples
c#asp.netorchardcmshubspotinfusionsoft

Migrate submission of form from InfusionSoft to Hubspot


I have a form in Orchar CMS, built with a ViewModel, in present times it take the data and submit with InfusionSoft, now, I need to migrate that method of submission to Hubspot, i can't found what I am looking for in the api documentation, but I need to migrate that and I can't find an example of how to do this, any suggestion or link where I can guide myself please!?!?. Here is an example of my form:

public class CreateTrialUserHubspotViewModel {

    [StringLength(50), Required, Display(Name = "First Name")]
    public string FirstName { get; set; }

    [StringLength(50), Required, Display(Name = "Last Name")]
    public string LastName { get; set; }

    [StringLength(50), Required, Display(Name = "Job title")]
    public string JobTitle { get; set; }

    [Display(Name = "inf_option_countryreport")]
    public bool Country_Reports { get; set; }

    [Display(Name = "inf_option_Economicmodel")]
    public bool Economic_Models { get; set; }

}

Then I have a controller that take all the data and submit it, here is an example in the method Register of my controller(This is not the full code)

[HttpPost, Themed]
    public ActionResult Register(CreateTrialUserViewModel newTrialUser) {    
        //Load Form values in this collection
        NameValueCollection formData = new NameValueCollection();
        formData["inf_form_xid"] = infFormXis;
        formData["inf_form_name"] = infFormName;
        formData["infusionsoft_version"] = infVersion;

}


Solution

  • Two strategies to try here:

    Using an Embeddable HubSpot Form (Simpler approach)

    You can create an embeddable 5-field form that sends data to HubSpot ONLY -- instructions in this user guide: https://knowledge.hubspot.com/forms-user-guide-v2/how-to-create-a-simple-form


    Submitting data from a custom form to HubSpot (More inline with your current approach)

    If you prefer to create the form in C# and Orchard, you can do that too. Create the form the way you would normally for your CMS, than send data to HubSpot using the Forms API and Submit Data endpoint: http://developers.hubspot.com/docs/methods/forms/submit_form

    Includes sample C# code. Enjoy!