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

@christopher-RVOAha! 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

13 Replies 13
jolle
Recognized Expert | Partner
Recognized Expert | 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

Marketing Operations Manager

HubSpot Certified Trainer

Create Your Own Free Signature
SDavisCT
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

I just wanted to say thanks, many months later - without this, I would not have connected that there were different ID numbers for contact owner vs deal owner. 

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
Recognized Expert | Partner
Recognized Expert | 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 @christopher-RVO any idea what could be the issue here?

Jacob Olle

Marketing Operations Manager

HubSpot Certified Trainer

Create Your Own Free Signature
danmoyle
Most Valuable Member | Elite Partner
Most Valuable Member | 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 my answer help? Please "mark as a solution" to help others find answers. Plus I really appreciate it!


Dan Moyle

HubSpot Advisor

LearningOps | Impulse Creative

emailAddress
dan@impulsecreative.com
website
https://impulsecreative.com/
Jnix284
Most Valuable Member | Elite Partner
Most Valuable Member | Elite 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?


If my reply answered your question please mark it as a solution to make it easier for others to find.



Jennifer Nixon - Delivery Lead at Aptitude 8

connect with Jen on Linkedin

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.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


christopher-RVO
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 - VP of Revenue at Aptitude 8


JF_dev
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@christopher-RVOThank 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 

christopher-RVO
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE
JF_dev
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@christopher-RVO 

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
christopher-RVO
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE
JF_dev
Solution
Participant

Getting INVALID_OWNER_ID error when trying to create timeline event

SOLVE

@christopher-RVOAha! 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!!