APIs & Integrations

Não aplicável

How to add attachment to a engagement?

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

0 Avaliação positiva
2 Respostas 2
3PETE
HubSpot Employee
HubSpot Employee

How to add attachment to a engagement?

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.

0 Avaliação positiva
Não aplicável

How to add attachment to a engagement?

$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’]);