Hello, im having an issue when Im tryin to assigned a task in Hubspot with a user:
Im doing the following request:
async function createHubspotTask(createdHubspot, taskTitle, taskBody, userId) {
const url = “https://api.hubapi.com/crm/v3/objects/tasks”;
const now = new Date();
const timestamp = now.toISOString();
const data = {
properties: {
hs\_timestamp: timestamp,
hs\_task\_subject: taskTitle,
hs\_task\_body: taskBody,
hs\_task\_type: "TODO",
hs\_task\_status: "NOT\_STARTED",
hubspot\_owner\_id: userId,
},
};
const config = {
headers: {
Authorization: \`Bearer ${createdHubspot.accessToken}\`,
"Content-Type": "application/json",
},
};
try {
const res = await axios.post(url, data, config);
return res.data;
} catch (error) {
console.error("Error creando la task de hubspot: ", error);
}
}
The errror im having is:
Property values were not valid: [{“isValid”:false,“message”:“50481782 was not a valid owner ID”,“error”:“INVALID_OWNER_ID”,“name”:“hubspot_owner_id”,“localizedErrorMessage”:"50481782 was not a valid owner ID.
But I think the user ID its Ok, because is the same that it appears on my profile user url:
https://app.hubspot.com/settings/24325849/users/user/50481782, as you can see my id is 50481782 so IDK why im receiving that error from the API.
Someone knows if Im missing something?
Thank you