Hello Ladies & Gentleman.
I’m stuck in creating a note via the API :
<?php
define( 'HUBSPOT_BASE_URL', 'https://api.hubapi.com' );
define( 'HUSPOT_ACCESS_TOKEN', '****-*****-********' );
require_once "./vendor/autoload.php";
$client = \HubSpot\Factory::createWithAccessToken(HUSPOT_ACCESS_TOKEN);
$noteProperties = [
"properties" => [
"hs_timestamp" => "2022-09-19T03:30:17.883Z",
"hs_note_body" => "Spoke with decision maker john",
"hubspot_owner_id" => "1234567"
]
];
$noteInput = new \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput($noteProperties);
$note = $hubspot->crm()->objects()->notes()->basicApi()->create($noteInput);
var_dump( $note );
?>
I guess it’s working (result 201 or 200 in the log) but the returned result looks like this :
object(HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput)#17 (1) {
["container":protected]=>
array(1) {
["properties"]=>
array(3) {
["hs_timestamp"]=>
string(24) "2022-09-19T03:30:17.883Z"
["hs_note_body"]=>
string(30) "Spoke with decision maker john"
["hubspot_owner_id"]=>
string(8) "1234567"
}
}
}
The ID is missing
.
I need this ID in order to associate the note to a deal. I checked with different timestamp and different owner ids - yeah not owners ids not contact ids -
but after one hour and half, it’s not working.
![]()
While typing the message I’ve just understood I was dumping the $noteInput instead of the $note ! Damned ![]()
Thank you for your support everyone, hope the snippet will help someone in the future ! ![]()