How to add attachment to a engagement?

engagements

#1

I’m using PHP to create a engagement with attachments with this code

$eng=array();
$text=“Prueba archivo adjunto”;
$eng[‘engagement’]=array(‘type’=>‘NOTE’,‘ownerId’=>16992238,‘active’=>true);
$eng[‘associations’]=array(‘dealIds’=>99396250);
$eng[‘attachments’]=array(‘id’=>5023526698);
$eng[‘metadata’]=array(‘body’=>$text);
$hubspot->engagements()->create($eng[‘engagement’],$eng[‘associations’],$eng[‘metadata’],$eng[‘attachments’]);

but when i create the engagement in hubspot the attachment array is empty .

anyone know why?

is solved, attachments is an array of arrays


#2

I’m glad it’s solved. when you get a chance it would be helpful to see the finished code in case anyone else comes across this.


#3

$eng=array();
$text=“Prueba archivo adjunto”;
$eng[‘engagement’]=array(‘type’=>‘NOTE’,‘ownerId’=>16992238,‘active’=>true);
$eng[‘associations’]=array(‘dealIds’=>99396250);
//this is the array of arrays
$eng[‘attachments’]=array(array(‘id’=>5034867180)
$eng[‘metadata’]=array(‘body’=>$text);
$hubspot->engagements()->create($eng[‘engagement’],$eng[‘associations’],$eng[‘metadata’],$eng[‘attachments’]);