# Associating note with ticket

**URL:** <https://community.hubspot.com/t/associating-note-with-ticket/88611>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [August 30, 2023, 1:31pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611 "2023-08-30T13:31:10Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 30, 2023, 1:31pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/1 "2023-08-30T13:31:10Z")

</div>

So I’m creating ticket and uploading file by API, exactly with hubspot-api-client package. Then I want to associate them together by note. Note has been created with hs\_attachment\_ids to uploaded file and association to ticket. But when I’m checking ticket out at HubSpot UI, no note or file is attached. API responds with success, I can get note back.

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 30, 2023, 1:36pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/2 "2023-08-30T13:36:26Z")

</div>

Hey @DDobkowski,

What does the system respond with if you make a request like this?

`GET https://api.hubapi.com/crm/v3/objects/notes/{NOTE_ID}?properties=hs_attachment_ids`

For instance when I make the request above for a note I see the following:

```lia-code-sample
{
 "results": [
 {
 "id": "19529202369",
 "properties": {
 "hs_attachment_ids": "76894753722",
 "hs_createdate": "2023-08-16T09:24:15.453Z",
 "hs_lastmodifieddate": "2023-08-16T09:24:15.453Z",
 "hs_object_id": "19529202369"
 },
 "createdAt": "2023-08-16T09:24:15.453Z",
 "updatedAt": "2023-08-16T09:24:15.453Z",
 "archived": false
 }
 ]
}

```

The value in “hs\_attachment\_ids” represents the ID of a file uploaded to the file manager in HubSpot. The reason I am asking to check this is to make sure that the attachment is correctly setup. Also, when you view the ticket can you see the note on the timeline of the record?

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 30, 2023, 2:37pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/3 "2023-08-30T14:37:00Z")

</div>

@coldrickjack ID of attachment is right. Also, there is no action at ticket timeline.

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 30, 2023, 3:22pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/4 "2023-08-30T15:22:52Z")

</div>

Thanks for sharing @DDobkowski. When you go to the Ticket Timeline do you see the note with attachment i.e something similar to the below:

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/6/56b4b3b22324c54f4bd8be7dff6e06fda53a6373.png)

If you don’t then whilst the note has been created successfully the association to the ticket record has not. In the example above I used a request as follows to create the note with attachment and associate to ticket:

```lia-code-sample
POST https://api.hubapi.com/crm/v3/objects/notes
BODY
{
 "properties": {
 "hs_timestamp": "2023-08-30T16:20:00.000Z",
 "hs_note_body": "Created via the API",
 "hubspot_owner_id": "1147024111",
 "hs_attachment_ids": "78235742693"
 },
 "associations": [
 {
 "to": {
 "id": "1685582803"
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 228
 }
 ]
 }
 ]
}

RESPONSE
{
 "id": "19852901360",
 "properties": {
 "hs_all_owner_ids": "1147024111",
 "hs_attachment_ids": "78235742693",
 "hs_body_preview": "Created via the API",
 "hs_body_preview_html": "<html>\n <head></head>\n <body>\n Created via the API\n </body>\n</html>",
 "hs_body_preview_is_truncated": "false",
 "hs_createdate": "2023-08-30T15:19:59.971Z",
 "hs_lastmodifieddate": "2023-08-30T15:19:59.971Z",
 "hs_note_body": "Created via the API",
 "hs_object_id": "19852901360",
 "hs_object_source": "INTEGRATION",
 "hs_object_source_id": "1914406",
 "hs_timestamp": "2023-08-30T16:20:00Z",
 "hs_user_ids_of_all_owners": "4592290",
 "hubspot_owner_assigneddate": "2023-08-30T15:19:59.971Z",
 "hubspot_owner_id": "1147024111"
 },
 "createdAt": "2023-08-30T15:19:59.971Z",
 "updatedAt": "2023-08-30T15:19:59.971Z",
 "archived": false
}

```

Note how I include an associations array, within I specify the ID of the ticket in the CRM and I also specify the associationTypeId which is 228 (Note to Ticket).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 30, 2023, 4:13pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/5 "2023-08-30T16:13:28Z")

</div>

![Zrzut ekranu 2023-08-30 o 17.42.22.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/4/e4558b5c9fa6a792f480820d39ff0e523508ddbd.png)

Here is my timeline.  
POST example is same as my request.

```lia-code-sample
properties={
 "hs_timestamp": "2023-08-30T15:54:43.890Z",
 "hs_attachment_ids": "",
 "hs_note_body": "attachment"
}
associations=[
 {
 "to": {
 "id": ""
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 228
 }
 ]
 }
]
note_input = SimplePublicObjectInputForCreate(properties=properties, associations=associations)
api_response = self.client.crm.objects.notes.basic_api.create(simple_public_object_input_for_create=note_input)

```

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 30, 2023, 4:24pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/6 "2023-08-30T16:24:16Z")

</div>

Are you using the Python client? If so it could be that the “SimplePublicObjectInputForCreate” is the issue as this class is no longer publicly available. See this thread [here](https://community.hubspot.com/t5/APIs-Integrations/SimplePublicObjectInputForCreate-does-not-exist-probably-wrong/td-p/771512).

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 31, 2023, 9:39am UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/7 "2023-08-31T09:39:15Z")

</div>

It doesn’t seem like an issue with that class, because I tested with simple requests.post() method. The same issue appeared, note is created but not associated with ticket. Here is response

```lia-code-sample
{
 "id": "",
 "properties": {
 "hs_attachment_ids": "",
 "hs_body_preview": "Test attachment",
 "hs_body_preview_html": "<html>\n <head></head>\n <body>\n Test attachment\n </body>\n</html>",
 "hs_body_preview_is_truncated": "false",
 "hs_createdate": "2023-08-31T09:34:49.983Z",
 "hs_lastmodifieddate": "2023-08-31T09:34:49.983Z",
 "hs_note_body": "Test attachment",
 "hs_object_id": "",
 "hs_object_source": "INTEGRATION",
 "hs_object_source_id": "",
 "hs_timestamp": "2023-08-31T09:34:49.608Z"
 },
 "createdAt": "2023-08-31T09:34:49.983Z",
 "updatedAt": "2023-08-31T09:34:49.983Z",
 "archived": False
}

```

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 31, 2023, 9:49am UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/8 "2023-08-31T09:49:53Z")

</div>

From my end using Python requests works just fine, the script below creates the note and associates to a ticket in the CRM.

```lia-code-sample
import requests
import json

url = "https://api.hubapi.com/crm/v3/objects/notes"

payload = json.dumps({
 "properties": {
 "hs_timestamp": "2023-08-31T10:45:00.000Z",
 "hs_note_body": "Created via the API",
 "hubspot_owner_id": "1147024111",
 "hs_attachment_ids": "78235742693"
 },
 "associations": [
 {
 "to": {
 "id": "1685582803"
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 228
 }
 ]
 }
 ]
})
headers = {
 'Content-Type': 'application/json',
 'Authorization': 'Bearer pat-eu1- ********-**** - ****-**** - ************'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

Response:

```lia-code-sample
{
 "id": "19882503621",
 "properties": {
 "hs_all_owner_ids": "1147024111",
 "hs_attachment_ids": "78235742693",
 "hs_body_preview": "Created via the API",
 "hs_body_preview_html": "<html>\n <head></head>\n <body>\n Created via the API\n </body>\n</html>",
 "hs_body_preview_is_truncated": "false",
 "hs_createdate": "2023-08-31T09:46:04.403Z",
 "hs_lastmodifieddate": "2023-08-31T09:46:04.403Z",
 "hs_note_body": "Created via the API",
 "hs_object_id": "19882503621",
 "hs_object_source": "INTEGRATION",
 "hs_object_source_id": "1914406",
 "hs_timestamp": "2023-08-31T10:45:00Z",
 "hs_user_ids_of_all_owners": "4592290",
 "hubspot_owner_assigneddate": "2023-08-31T09:46:04.403Z",
 "hubspot_owner_id": "1147024111"
 },
 "createdAt": "2023-08-31T09:46:04.403Z",
 "updatedAt": "2023-08-31T09:46:04.403Z",
 "archived": false
}

```

Output:

 ![Screenshot 2023-08-31 at 10.49.18.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/d/ddb711fa0a10c88ee9b712b2c14c0f6d09c975de.png)

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 31, 2023, 9:55am UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/9 "2023-08-31T09:55:37Z")

</div>

That’s exactly how I tested it. The only difference is that I’m not giving “hubspot\_owner\_id”, but it’s optional. I’m starting to thinking that it’s some internal hubspot problem or something is wrong with setup of private app.

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [September 1, 2023, 10:48am UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/10 "2023-09-01T10:48:54Z")

</div>

Funny thing. I made a request to get this ticket associations. It looks like there are some, but I can’t see them at ticket panel.

```lia-code-sample
{
 "results": [
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 },
 {
 "toObjectId":,
 "associationTypes": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 227,
 "label": None
 }
 ]
 }
 ]
}

```

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 30, 2023, 4:14pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/11 "2023-08-30T16:14:56Z")

</div>

And here is response:

```lia-code-sample
{"archived": False,
"archived_at": None,
"created_at": datetime.datetime(2023, 8, 30, 15, 54, 44, 273000, tzinfo=tzlocal()),
"id": "",
"properties": {"hs_attachment_ids": "",
 "hs_body_preview": "attachment",
 "hs_body_preview_html": "<html>\n"
 " <body>\n"
 " attachment\n"
 " </body>\n"
 "</html>",
 "hs_body_preview_is_truncated": "false",
 "hs_createdate": "2023-08-30T15:54:44.273Z",
 "hs_lastmodifieddate": "2023-08-30T15:54:44.273Z",
 "hs_note_body": "attachment",
 "hs_object_id": "",
 "hs_object_source": "INTEGRATION",
 "hs_object_source_id": "",
 "hs_timestamp": "2023-08-30T15:54:43.890Z"},
"properties_with_history": None,
"updated_at": datetime.datetime(2023, 8, 30, 15, 54, 44, 273000, tzinfo=tzlocal())}

```

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 30, 2023, 4:18pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/12 "2023-08-30T16:18:08Z")

</div>

And here is the result:

```lia-code-sample
{"archived": False,
"archived_at": None,
"created_at": "2023-08-30T15:54:44.273Z",
"id": "",
"properties": {"hs_attachment_ids": "",
 "hs_body_preview": "attachment",
 "hs_body_preview_html": "<html>\n"
 " <body>\n"
 " attachment\n"
 " </body>\n"
 "</html>",
 "hs_body_preview_is_truncated": "false",
 "hs_createdate": "2023-08-30T15:54:44.273Z",
 "hs_lastmodifieddate": "2023-08-30T15:54:44.273Z",
 "hs_note_body": "attachment",
 "hs_object_id": "",
 "hs_object_source": "INTEGRATION",
 "hs_object_source_id": "",
 "hs_timestamp": "2023-08-30T15:54:43.890Z"},
"properties_with_history": None,
"updated_at": "2023-08-30T15:54:44.273Z"}

```

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 30, 2023, 2:41pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/13 "2023-08-30T14:41:25Z")

</div>

I can’t paste result because of some “spam” filter.

---

<div class="post-metadata">

**Author:** ![DDobkowski](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DDobkowski](https://community.hubspot.com/u/DDobkowski)\
**Post date:** [August 30, 2023, 2:43pm UTC](https://community.hubspot.com/t/associating-note-with-ticket/88611/14 "2023-08-30T14:43:01Z")

</div>

```lia-code-sample
{
 "id": "",
 "properties": {
 "hs_attachment_ids": "",
 "hs_createdate": "2023-08-30T13:59:28.834Z",
 "hs_lastmodifieddate": "2023-08-30T13:59:28.834Z",
 "hs_object_id": ""
 },
 "createdAt": "2023-08-30T13:59:28.834Z",
 "updatedAt": "2023-08-30T13:59:28.834Z",
 "archived": false
}

```

I had to delete ids to be able to paste result
