How do you set secondary email addresses on Contacts?
Morning
I am working on an integration, and part of the flow is that users on our system can change their email address. When this happens I need to be able to locate the Contact record on HubSpot, update their email address and move their old email into the hs_additional_emails field.
The docs say you can simply update this property (a comma separated list) and you are good to go.
But when I try this the API tells me this is a computed property and is READONLY. So - what do I do?
I have seen reference to beta and legacy endpoints for working with secondary email addresses but can't actually find a concrete answer. Also using a totally separate endpoint makes my code more complex. Why not gives devs both options?
How do you set secondary email addresses on Contacts?
Hey, @PTSergio👋 I'm working with my resources on this. Here's the update (so far):
the documentation around the v3 endpoint is incorrect and will be updated
you'll need to use the v1 endpoint listed here. Because it is a legacy endpoint, it has limitations that our v3 endpoints don't. Namely, that you'll need to send multiple requests if you have to add more than one secondary email address. And you cannot create a Contact and set the secondary email address in a single call. You'll have to make separate requests to accomplish this — one to create the contact + add values to your specified properties and a second request to the secondary email endpoint
I filed the doc update request just now. I'm out for vacation starting tomorrow but will update this post if I get any additional updates from my internal resources.
Thank you very much for taking the time to make this post and flag this issue. It's likely caused others a few unnecessary headaches.
Talk soon(ish) 😊 — Jaycee
HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates. Learn More.
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !
How do you set secondary email addresses on Contacts?
Hey, @PTSergio👋 I am going to flag this to my internal resources and try to get us confirmation. Here's my example, which returns a `400` response. I agree with you, this conflicts with what the documentation states.
POST https://api.hubapi.com/crm/v3/objects/contacts
{
"status": "error",
"message": "Property values were not valid: [{\"isValid\":false,\"message\":\"\\\"hs_additional_emails\\\" is a calculated property; its value cannot be set.\",\"error\":\"READ_ONLY_VALUE\",\"name\":\"hs_additional_emails\",\"localizedErrorMessage\":\"\\\"hs_additional_emails\\\" is a calculated property; its value cannot be set.\",\"propertyValue\":\"labonz@bobsburgers.com\",\"portalId\":22245342}]",
"correlationId": "2f951629-106e-43ee-980e-7a15681c4033",
"category": "VALIDATION_ERROR"
}
Thanks! — Jaycee
HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates. Learn More.
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !
We are now 5 months later and the documentation for v3 is still incorrect.
I just lost quite a lot of time on this, before I found this post.
While the best would be for the endpoint to work as expected, what is at least the status of your documentation update request ?
This entire part:
To add secondary emails to a contact, when creating or editing the contact, in your request body, include emails in thehs_additional_emailsfield. Multiple emails can be separated by a semi-colon.
Needs to be replace with something among the lines of "you cannot changehs_additional_emails through the API".