Hello everybody!
I’m working with the Hubspot API to create a website where you can create tickets using forms and see their engagements.
1) Send ticket form via javascript form.
2) Read tickets
curl --location --request POST 'https://api.hubapi.com/crm/v3/objects/tickets/search?hapikey=demo' \
--header 'content-type: application/json' \
--header 'Cookie: __cfduid=defdf8f9d3ce28c171639a737aecf19991617882670' \
--data-raw '{
"filterGroups": [
{
"filters": [
{
"propertyName": "associations.contact",
"operator": "EQ",
"value": "344930714"
}
]
}
],
"sorts": [
{
"propertyName": "createdate",
"direction": "DESCENDING"
}
],
"properties": [
],
"limit": 10,
"after": 0
}'
3) Read engagements
curl --location --request GET 'https://api.hubapi.com/engagements/v1/engagements/13073367213?hapikey=demo' \
--header 'Cookie: __cfduid=defdf8f9d3ce28c171639a737aecf19991617882670'
Everything that is answered from the hubspot CRM in the conversation appears on my website correctly.
And if you reply by mail (gmail) to this message, it appears correctly as engagement and as a response in the conversation
What I want now is to respond to this conversation via API as if it were answered by email and that it appeared in the Hubspot CRM conversation
1) Create engagement vía API.
curl --location --request POST 'https://api.hubapi.com/engagements/v1/engagements?hapikey=demo' \
--header 'Content-Type: application/json' \
--header 'Cookie: __cfduid=defdf8f9d3ce28c171639a737aecf19991617882670' \
--data-raw '{
"engagement": {
"active": true,
"ownerId": 70505496,
"type": "EMAIL",
"timestamp": 1620297687888,
"source": "CONVERSATIONS"
},
"associations": {
"contactIds": [101],
"companyIds": [ ],
"dealIds": [ ],
"ownerIds": [ ],
"ticketIds":[400047780 ]
},
"attachments": [
],
"metadata": {
"from": {
"email": "email@domain.com",
"firstName": "First",
"lastName": "Last"
},
"to": [
{
"raw": "support@19678522.hubspot-inbox.com",
"email": "support@19678522.hubspot-inbox.com"
}
],
"cc": [],
"bcc": [],
"subject": "Re: Prueba de texto",
"html": "<div>aaaa</div>",
"text": "aaaaa"
}
}'
With this endpoint, the engagement is correctly created but it does NOT appear as a response in the Husbpot CRM chain (CONVERSATIONS).
However, it does appear in the Emails and Activity sections of the ticket.
Is there any way to create an engagement as a response to the conversation chain as if it were answered by Email and it appeared in the Conversations section of the Hubspot CRM?
Thanks and sorry for my english!




