APIs & Integrations

Not applicable

Create contact from non-contact visitor via API

We have a visitor (let's say vid 1234) (or we have the hubspot token too)
that has the property is-contact: false and now we want
to store additional data (incl email) to that visitor.

But when I try to use the API I get an error that I can
only set properties for contacts.
E.g.:

POST https://api.hubapi.com/contacts/v1/contact/vid/1234/profile?hapikey=KEY_HERE
Content-Type: application/json
{
"properties": [
{"property": "prop1", "value": 23},
{"property": "email", "value": "email@example.com"},
{"property": "propbool", "value": false}
]
}

#+RESULTS:
{
"status": "error",
"message": "Can't set properties when vid is not a contact.",
"correlationId": "0f041be4-6efb-4191-bbbb-ffffffff",
"requestId": "xxxxxxxxxxxxxxxx"
}

After searching here it seems the only way to do
this is the forms API?!
Now I made a simple form with only an email field
and when I post to that, it works and the visitor is
converted but he always gets the welcome email
which we do not want.

Is there a way to make this visitor a contact
or otherwise add the additional information
or make the forms post not send the welcome email?

Thanks,
Daniel

0 Upvotes
5 Replies 5
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Create contact from non-contact visitor via API

Hi @dakra,

Apologies for the delay here, and I appreciate the clarity. I think we had a miscommunication somewhere along the line; your use case is totally reasonable, I think I was under the impression that you wanted to create contacts out of these visitors without the visitor going through any conversion event.

To address your specific scenario, I'd need to know exactly what the 'conversion event' is. The best move might be using the Forms API, or perhaps the Events HTTP API. I've included info on these methods below, for reference:

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Create contact from non-contact visitor via API

Hi @dakra and @StDu,

I'm not sure I understand the use case you're describing. A non-contact visitor record (as described above) generally represents a website visitor who has not yet converted on a form or otherwise become a contact. Why are you trying to update contact properties and/or create a contact record for these visitors?

If you're identifying them via a login or some other method, you'll likely want to use the 'identify' method of the Tracking Code API:

0 Upvotes
Not applicable

Create contact from non-contact visitor via API

That's correct in our case.

We have 2 systems and track that user (by saving his hubspotutk) between those systems.
So we have visitor in system A and he then performs an action in system B
I want to convert him to a contact and add properties to it.
I'm new to HubSpot but that sounds like a typical use-case to me?!
What's the workflow normally used then?

NOTE: The "conversion" is not happening on a website but on client software
so we have to do the hubspot stuff in a seperate worker with api calls
and we do not want another welcome email to be send.

Thanks for your answer.

0 Upvotes
Not applicable

Create contact from non-contact visitor via API

Just a short clarification: the welcome mail is the double-opt-in email which is send out to every new contact. And since it is only possible to exclude landingpages (not forms) from this, we don't see any other way to not have the double-opt-in mail sent out. Is there a way to set the "marketing email confirmation status" at the same time the contact is created, so Hubspot recognized that the contact is already confirmed and doesn't send out the double-opt-in mail?

Thanks for your help!

0 Upvotes
Not applicable

Create contact from non-contact visitor via API

Is there a way to set the "marketing email confirmation status" at the same time the contact is created, so Hubspot recognized that the contact is already confirmed and doesn't send out the double-opt-in mail?

I have complete freedom of what and how I can post to the rest/forms api.
How can I set the marketing email confirmation status?
I didn't find it in the 'form fields' and of course I can not send it with the normal rest api
as it is not a contact yet (like in my original post).

Thanks for your help!

0 Upvotes