# Respond to a ticket conversation via API

**URL:** <https://community.hubspot.com/t/respond-to-a-ticket-conversation-via-api/36923>\
**Category:** APIs & Integrations\
**Tags:** email\
**Created:** [May 7, 2021, 1:11pm UTC](https://community.hubspot.com/t/respond-to-a-ticket-conversation-via-api/36923 "2021-05-07T13:11:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![EstebanCastro](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/estebancastro/32/76793_2.png) [@EstebanCastro](https://community.hubspot.com/u/EstebanCastro)\
**Post date:** [May 7, 2021, 1:11pm UTC](https://community.hubspot.com/t/respond-to-a-ticket-conversation-via-api/36923/1 "2021-05-07T13:11:30Z")

</div>

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.

 ![Captura de pantalla 2021-05-07 a las 14.57.02.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/6/674d18349dbe92289f9ef710d80c6ad155ec822c.png)

2) Read tickets

```lia-code-sample
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

```lia-code-sample
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.

 ![Captura de pantalla 2021-05-07 a las 15.00.19.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/b/1b745dca95a69e13e1fc24fec61854dc209e1973.png)

And if you reply by mail (gmail) to this message, it appears correctly as engagement and as a response in the conversation

 ![Captura de pantalla 2021-05-07 a las 15.01.18.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/0/f00938f2ea0c32d036b5fe747eb70a4a25eb58cf.png)

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.

```lia-code-sample
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).

 ![Captura de pantalla 2021-05-07 a las 15.04.24.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/f/fa1f593b7787e2efc1f2cca4e5d9ee59a70752fc.png)

However, it does appear in the Emails and Activity sections of the ticket.

 ![Captura de pantalla 2021-05-07 a las 15.07.12.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/b/ab093504ae94e4b0c33d941602e1eb51e87c328f.png)

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!

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [May 7, 2021, 4:11pm UTC](https://community.hubspot.com/t/respond-to-a-ticket-conversation-via-api/36923/2 "2021-05-07T16:11:16Z")

</div>

@tominal , do you have any advice here?

---

<div class="post-metadata">

**Author:** ![tominal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tominal/32/73018_2.png) [@tominal](https://community.hubspot.com/u/tominal)\
**Post date:** [May 7, 2021, 7:29pm UTC](https://community.hubspot.com/t/respond-to-a-ticket-conversation-via-api/36923/3 "2021-05-07T19:29:55Z")

</div>

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](https://legacydocs.hubspot.com/docs/methods/engagements/update_engagement-patch) ( 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!

---

<div class="post-metadata">

**Author:** ![EstebanCastro](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/estebancastro/32/76793_2.png) [@EstebanCastro](https://community.hubspot.com/u/EstebanCastro)\
**Post date:** [May 10, 2021, 9:26am UTC](https://community.hubspot.com/t/respond-to-a-ticket-conversation-via-api/36923/4 "2021-05-10T09:26:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AGarcia8](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/agarcia8/32/68963_2.png) [@AGarcia8](https://community.hubspot.com/u/AGarcia8)\
**Post date:** [August 30, 2021, 7:48am UTC](https://community.hubspot.com/t/respond-to-a-ticket-conversation-via-api/36923/5 "2021-08-30T07:48:53Z")

</div>

Same issue here.
