CRM

JF_dev
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

Hello,

 

I'm trying to create a timeline event on a contact. The event has a custom token, `ownerId` with a mapping to a custom property on Contacts named `owner`.

The custom property is a HubSpot user field type.

 

So the idea is then when I create an action in the contact activity timeline and pass an `ownerId`, the contact will automatically get assigned to the owner.

 

But the issue is that when I make the request to:

POST /crm/v3/timeline/events

with body (abbreviated for concision) :
{

...

  "tokens": { "ownerId": 1234 }

}

I get the following error:

 

validationResults":[{"isValid":false,"message":"1234 was not a valid owner ID","error":"INVALID_OWNER_ID","name":"owner"}]

 

Note: The ID isn't actually 1234, it's an owner ID that I got from querying the /crm/v3/owners endpoint, so I know it's a valid owner ID.

 

Please let me know if you see anything that I'm doing wrong, or if there's a better way to assign owners to contacts via timeline events

1 Accepted solution
JF_dev
Solution
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@chrisworqflowAha! Figured it out 🙂

 

I was querying the /owners endpoint, but using the developer API key, which returns a different owner ID than if I query the same endpoint using OAuth.

 

So if I authenticate with OAuth instead, I find the owner with the correct ID which allows me to pass this ID in when creating a Contact timeline event, and have it auto-assign the owner to the contact. Hooray!!

View solution in original post

12 Replies 12
jolle
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

Hey @JF_dev, thanks for sharing! I don't have a ton of HubSpot development experience, but I'm wondering if this has anything to do with the fact that you're mapping to a custom contact property instead of the default "Contact owner" property. Do you get the same result if you use "Contact owner" instead?

Jacob Olle

Director of Marketing Technology

NgageContent

HubSpot Certified Trainer

emailAddress
jacob@ngagecontent.com
website
https://ngagecontent.com/
Create Your Own Free Signature
JF_dev
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

Hi @jolle,

 

There's no "Contact owner" property mapping in the UI dropdown menu, but I did some digging and it looks like the field is called `hubspot_owner_id` .

 

If I set my custom token to map to that field (it lets me "create" a field with that name), I see the same behavior.

 

I've tried setting the data type to either String or Integer, and in both cases I still get the INVALID_OWNER_ID error back 😕

jolle
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

Thanks for the quick response! I'm going to tap into some awesome HubSpot Community members.

 

@danmoyle @Jnix284 @chrisworqflow any idea what could be the issue here?

Jacob Olle

Director of Marketing Technology

NgageContent

HubSpot Certified Trainer

emailAddress
jacob@ngagecontent.com
website
https://ngagecontent.com/
Create Your Own Free Signature
danmoyle
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

Thanks for thinking of me @jolle. My dev chops are light, but I'll share this with my colleague @Kevin-C and our dev team. Kevin may have insight for you @JF_dev .

 


Did this post help solve your problem? You can help others find answers when you accept a reply as a solution. (I also appreciate it!)


Dan Moyle

HubSpot Advisor

Impulse Creative

269-371-4753
dan@impulsecreative.com
https://impulsecreative.com/
Jnix284
Thought Leader | Partner
Thought Leader | Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

Hi @jolle and @JF_dev , sorry I can't be of more help, I don't do any development on the workflow side.

 

Maybe @Teun might be able to help or point you in the right direction?


maka Agency
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

Hi @JF_dev ,

 

I could be mistaken, but the ownerId is not used to assign the contact, but assign the engagement, like a task. So you can not set the owner of a contact using the timeline property.

Check these docs, I hope this explains it a bit better.



Did my answer solve your issue? Help the community by marking it as the solution.
chrisworqflow
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@jolle @danmoyle @JF_dev  I believe this is because the property isn't considered a string because contact owner is a user-property (Internal ID), meaning that it updates with the internal users in the platform. 

Are you mapping the token based upon the internal IDs of the HubSpot users?

Go to Settings->Properties->Contact Properties and search and click on the Contact Owner Property. On that screen, it will list your contact owners (users) and their internal value (user ID.)

Christopher Barnett

Founder / CEO

Revenue Operations | WORQFLOW

mobilePhone
(832) 257-4192
emailAddress
christopher@worqflowmarketing.com
website
worqflowmarketing.com
address
17350 State Hwy 249, Ste 220 #6307, Houston, TX, 77064
JF_dev
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@chrisworqflowThank you for pointing me to the Contact Owner Property!! I did some more digging and can now clearly state what the problem is.

 

The property being a string is not the actual issue, it's that the IDs listed for the contact owners don't match the ones returned by the API.

 

Once I used the "internal value" listed in the UI, it worked!

I was able to use ID `123456` as the value of my custom token `ownerId`.

This custom token has a Contact property mapping of `hubspot_owner_id`, so when I create a timeline event for a contact that doesn't have an owner, it automatically gets assigned to the owner matching that ID.

Screen Shot 2022-10-26 at 2.57.09 PM.png

So the main issue here is, what _is_ id `123456`?? As far as I can tell it's not a User id nor an Owner id.

 

When I query the CRM Owners API, I find `John Doe` but its `id` and `userId` are different than the "Internal Value" ID above.

 

Is there any way for me to find this ID via any APIs?

 

cc @Teun @danmoyle 

chrisworqflow
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@JF_dev  This article may help: https://legacydocs.hubspot.com/docs/methods/owners/get_owners

 

Christopher Barnett

Founder / CEO

Revenue Operations | WORQFLOW

mobilePhone
(832) 257-4192
emailAddress
christopher@worqflowmarketing.com
website
worqflowmarketing.com
address
17350 State Hwy 249, Ste 220 #6307, Houston, TX, 77064
JF_dev
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@chrisworqflow 

I was previously querying the v3 endpoint: "/crm/v3/owners" and only getting back "id" and "userId"

 

The article you linked me is for the v2 endpoint: "/owners/v2/owners" which returns more stuff (portalId, remoteId, activeUserId) but unfortunately none of them match the "Internal Value" id from the UI, which is the only one that works 😞

0 Upvotes
chrisworqflow
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@JF_dev  How about this one: 

https://developers.hubspot.com/docs/api/crm/owners

Christopher Barnett

Founder / CEO

Revenue Operations | WORQFLOW

mobilePhone
(832) 257-4192
emailAddress
christopher@worqflowmarketing.com
website
worqflowmarketing.com
address
17350 State Hwy 249, Ste 220 #6307, Houston, TX, 77064
JF_dev
Solution
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@chrisworqflowAha! Figured it out 🙂

 

I was querying the /owners endpoint, but using the developer API key, which returns a different owner ID than if I query the same endpoint using OAuth.

 

So if I authenticate with OAuth instead, I find the owner with the correct ID which allows me to pass this ID in when creating a Contact timeline event, and have it auto-assign the owner to the contact. Hooray!!