May 7, 2021 9:11 AM
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!
Solved! Go to Solution.
May 7, 2021 3:29 PM
This is an interesting one. While I don't think it's possible through the API, that doesn't mean it's not impossible to keep it in that single engagement.
You could update ( to append to ) that engagement's HTML body with the reply's HTML to make it look like a thread. Does that make sense? It sounds better in my head but it may not accomplish the exact look of what Esteban is looking for.
Hope that helps!
Aug 30, 2021 3:48 AM
Same issue here.
May 10, 2021 5:26 AM
Thanks for the response and ideas.
I think they serve me for what I want to do.
Hope you keep improving the API. Nice job.
Greetings
May 7, 2021 12:11 PM
@tominal , do you have any advice here?
May 7, 2021 3:29 PM
This is an interesting one. While I don't think it's possible through the API, that doesn't mean it's not impossible to keep it in that single engagement.
You could update ( to append to ) that engagement's HTML body with the reply's HTML to make it look like a thread. Does that make sense? It sounds better in my head but it may not accomplish the exact look of what Esteban is looking for.
Hope that helps!