This package extends Optimizely Forms to allow for pushing a users' data directly into HubSpot CRM via a HubSpot Form.
There are three steps to getting up and running.
- Update startup.cs
- Update your appSetting.json
- Configure your Optimizely Form
Add the following to your startup.cs
services.Configure<HubSpotPushOptions>(_configuration.GetSection("HubSpotPush"));
- Log into HubSpot
- Use the cog in the top right to enter settings
- Then go to Private Apps
- Here you can go to an existing app, or create a new one - either way, you should then navigate to the Auth tab, and take a copy of your apps Access token. Ensure that your app is scoped to use "forms".
- Add this Access token as a BearerToken to appSettings
"HubSpotPush": {
"BearerToken": "pat-xxx-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
}
You need to do two things.
- Set your Form ID
- Configure your Optimizely Form fields
- Log into HubSpot
- Go to your form
- Edit your form
- Click Embed, then select the option for Embdedded code
- You will see a block of JavaScript with a formId - copy this!
<script charset="utf-8" type="text/javascript" src="//js-xx1.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "xxx",
portalId: "xxxxxxxxxx",
formId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
});
</script>
- In your Optimizely Form, goto Settings
- Add a WebHook endpoint to your form
- This should be set to hs:// and then the formId you copied in step 5.
For each field you want to send to HubSpot, make sure that the fieldname in Hubspot (lastname, email)...
...matches the fieldname you have set in Optimizely Forms...
The label for your fields can differ, but the Name of the field must be the same