APIs & Integrations

AGran
Participant

Engagement API with PHP

Hey,

 

using the api v3 (i.e. https://github.com/HubSpot/hubspot-api-php) I can't seem to find any engagement api implementation. Does that mean I need to use https://github.com/HubSpot/hubspot-php in parallel? That seems horrible.

Any other idea? I need to associate emails with tickets, nothing to spectacular, but obviously needs engagement api.

 

regards

Alex

4 Replies 4
asdfsadfasdf
Member

Engagement API with PHP

2 years later and still nothing...

0 Upvotes
cl77
Participant

Engagement API with PHP

One year later.. is engagement api still not implementet in hubspot-api-php ?

0 Upvotes
AGran
Participant

Engagement API with PHP

Hey,
thanks, that's the super manual way without using an api client. I know about that, but I was looking into using the provided clients.

 

regards

Alex

0 Upvotes
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Engagement API with PHP

Hi @AGran ,

please use this code to create engagment with PHP : public function createActivityhubspot()

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.hubapi.com/engagements/v1/engagements',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"engagement": {
"active": true,
"ownerId": 1,
"type": "CALL",
"timestamp":'.$time.'
},
"associations": {
"contactIds": [
"'.$contacteID.'"
]
},
"attachments": [
{
"id": 0
}
],
"metadata":{
"toNumber":'.$tophone.',
"fromNumber":'.$fromphone.',
"durationMilliseconds": '.$CallDurationa.',
"title" : "Call Test",
"body" : "Testing twillo",
"disposition" : "'.$despoID.'",
"recordingUrl":"'.$RecordingUrl.'"
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'authorization: Bearer '.$token
),
));

$response = curl_exec($curl);

} Make sure need to use your variables and choose type what ever you want as i was creating call engament so i choose type call. https://prnt.sc/1z9i0qv screenshot attached , API Doc : https://legacydocs.hubspot.com/docs/methods/engagements/create_engagement


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.

0 Upvotes