APIs & Integrations

diogodpc
Participant | Elite Partner
Participant | Elite Partner

Creating Note via API - Created By or Owner fields

SOLVE

Hello!

 

When a user creates a note via HubSpot app, the creator is identified:

 

Notice the "by Diogo Cabral", the user who created the note.

Created ByCreated By

 

However, when you create via API, I can't get this to show up:

No Created ByNo Created By

 

Here's the JSON I'm using:

 

{
"engagement": {
"active": true,
"ownerId": <redacted>,
"type": "NOTE",
"timestamp": 1404122644778
},
"associations": {
"contactIds": [4009],
"companyIds": [ ],
"dealIds": [ ],
"ownerIds": [<redacted>],
"ticketIds": [ ]
},
"attachments": [ ],
"metadata": {
"body": "bla bla bla"
}
}
(sorry, I can't format this, for some reason)

 

I've tried everything I can remember, like adding createdBy, ownerId in metadata and in associations, source/sourceId, but can't get it to appear.

 

In the context of a data migration, it's quite important to be know who created a note in some other system.

 

Can anyone offer assistance?

 

Thanks!

 

0 Upvotes
1 Accepted solution
diogodpc
Solution
Participant | Elite Partner
Participant | Elite Partner

Creating Note via API - Created By or Owner fields

SOLVE

Hey Mansoor,

 

Thanks for your response - are you using API token or Oauth to authenticate? I'm thinking maybe that's the issue.

 

I'm using an API key, and have triple checked the User ID by GETting existing engagements - it's the correct value, unfortunately...

 

Thanks,

dc

View solution in original post

0 Upvotes
4 Replies 4
diogodpc
Participant | Elite Partner
Participant | Elite Partner

Creating Note via API - Created By or Owner fields

SOLVE

Hi Mansoor,

 

You are absolutely right!

 

For the record, here's where I was wrong: I thought the user ID was the last part of the URL when you go into a user's page:

https://app.hubspot.com/settings/<instanceId>/users/editUser/IdGoesHere

 

And that's the value I was using.

 

But it turns out that is not the ID. I got the ID like you said, by going into a deal and inspecting the OwnerID element. Sent in the correct ID, and worked like a charm.

 

Thanks very much!

dc

0 Upvotes
Mansoor
Member

Creating Note via API - Created By or Owner fields

SOLVE

I am using an API token. 

I was able to find the ownerID going through the manage properties on a deal and using the owner ID from the list of populated values. 

 

0 Upvotes
diogodpc
Solution
Participant | Elite Partner
Participant | Elite Partner

Creating Note via API - Created By or Owner fields

SOLVE

Hey Mansoor,

 

Thanks for your response - are you using API token or Oauth to authenticate? I'm thinking maybe that's the issue.

 

I'm using an API key, and have triple checked the User ID by GETting existing engagements - it's the correct value, unfortunately...

 

Thanks,

dc

0 Upvotes
Mansoor
Member

Creating Note via API - Created By or Owner fields

SOLVE

I would check to make sure you are supplying the right ownerId. These are hubspot internal users. 

here is what I am using and it is allowing me to see the the "By OWNER":

 

const noteObj = await hubspot.engagements.create({
engagement: {
active: true,
ownerId: 47517632,
type: 'NOTE',
timestamp: Date.now()
},
associations: {
contactIds: [],
companyIds: [],
dealIds: [],
ownerIds: [],
ticketIds: []
},
attachments: [],
metadata: {
body: `OWNER ID TEST`
}
});
0 Upvotes