This message was deleted.
# markops
s
This message was deleted.
s
Capture from cookie and send the hs cookie parameter while sending the contact details
https://legacydocs.hubspot.com/docs/methods/forms/submit_form Check for hubspotutk field which is important here to let HubSpot map its cookies with the contact email.
s
Is your front-end form managed by Hubspot or yours? Are these values hardcoded? Why aren’t you simply using HS script on page to create contacts? In case you didn’t know, HS tracking snippet will automatically create/update contacts when form fill happens on any page. You just need to be running the JS on-page (even if your form is external). Requires no engineering or APIs. But your set up looks more like a server to server since you are using Contacts API. In a contact object in HS, these input fields are ‘property’, each property field is identified (by APIs) via a ‘key’ — so, I’d debug there to see if the right ‘key’ value is passed in the API payload. One other thing is to check if the API user has what it takes to write data into those fields. (field level permissions settings) Hope this helps.
🙌 3
s
There are times where HS will not automatically create/update contacts on form fills even if tracking code is present. There are few conditions around form elements that needs to be fulfilled for that.
a
He's sending via API, I don’t understand how cookies will help. May be I didn't learn anything in engg…
A good starting point I guess what SV suggested. Another thing that I would check is if the key:value that you're passing might be a default pair that might be restricted in someway. I think a tech support can only help in that case. But start from the ones that SV suggested.
r
Hey folks - yes, the setup is server to server
🙌 1
s
@Arnav Mahajan I have the same setup done twice. 😛 You need to pass hubspotutk parameter when passing via API. Pls check the documentation sent earlier.
a
Brother cookie is a frontend thing, API as I know get called from the server side, may be I’m dumb here but not sure what you mean when you store the data in cookie and send it via API.
And if you're calling the API from frontend how do you secure your auth token?
Anyone can get it from the network call and change your data in Hubspot
s
I am not sure if you understand how HubSpot tracking works. HubSpot stores a cookie called hubspotutk which helps it to track web activity once it maps it to an email ( form fills or mail opens/clicks ). On form submission via API, the script needs to fetch this hubspotutk parameter from cookie and pass it to HubSpot via API.
This doc image is from HubSpot API doc shared earlier.
It is not calling from frontend. It is not complicated as one might think. Just a simple API call with an extra parameter.
a
This is not what I am talking about, I am talking about the auth. This is to simply map an unidentified user to the form data. My question is - if you are calling an API from the frontend (since you are passing the cookie data via the API). So, just that I make it clear , cookies are in front end and are a temporary storage of your browser. API is application programming interface which lets 2 applications talk to each other. When we call the APIs, every app secures it with an auth token, this is not possible from frontend because if you do it, it will reveal the auth token or the API keys making the application insecure because with APIs you can do mostly everything (including extract all the data). So help me understand if you are calling you Hubspot API from the frontend, if yes - change it because if someone wants, they can get all your Hubspot data
🙏 1
s
Not calling HubSpot API from the frontend. Did you get a chance to go through this - https://legacydocs.hubspot.com/docs/methods/forms/submit_form ?
a
Just went through it. I get it now. But I think, because this is unauthenticated, it might have been misused and Hubspot deprecated it. (I would suggest you not to use it, because I can send random data with this API call to your Hubspot)…just a suggestion.
👍 1
The only safety feature here I am seeing is - API rate limiting and CORS may be because it is tracking User-Agent.
@Rohit can you send a sample JSON that you are sending to the post call? I tried it just now with Postman, worked fine for me.
Here’s what I got when i created a contact with the bulk contact creation API
Here’s the workaround that I used….from what I understood, you need the source of all the contacts that you are creating with the APIs. Hubspot API can not change the web Analytics properties (i think because they only let their JS or SDKs to edit those). I created a new custom field here and updated that, you can filter based on the new property and run your workflows @Rohit
🙌 2
s
@Rohit As @Arnav Mahajan suggests, get your devs to make a Post call to Contact API endpoint via Postman with a sample payload. It should directly show the error. @Rohit I’m not a fan of using server to server setup simply because it has a lot of moving parts (frontend to backend to HS). And requires engineering time to debug everything. Short of that, in HS you have Forms API that you could consider, that is more simple to work with and easier to debug as well. @Swarnendu Dutta the on-page snippet from Hubstpot if running on that page will capture the all the form input. One just needs to make sure • A form is created in Hubspot with all the front-end fields • All custom form fields (if any) are created as a property • The HTML form fields’ internal name uses the right ‘key’ (property key in Husbpot) (There’s a documentation of Hubpspot, you can find by searching for ’non-hubspot forms fills into hubspot)
🙌 1
r
omg, thanks guys! I've sent all your comments to our developer. @Arnav Mahajan I don't know how to get the JSON sample, but I'll get it from our dev and reach out to you. @Swarnendu Dutta @sv410_ this is really helpful, and hopefully, we'll find some solution. P.S. sorry - I'm not a tech guy, so I couldn't participate in this communication that much. Thanks again 🙌
s
My knowledge around this could be a bit dated. Faced the same problem a few years ago and this is how we solved it. 1. Don't use the contacts api. Instead, do a form submit. 2. If you do a form submit, you can send the cookie easily with the payload 3. If the contact did not exist already, a new contact will be created during the form fill API call & Hubspot will get the historic context via the cookie Hope this helps 🙂
💯 1