Skip to main content
Answered

Intercom API - Reply ticket attachments

  • October 17, 2024
  • 2 replies
  • 50 views

The attachments that are upload through the browser are working fine as seen in the image and json file attached (red sample label image)

But attachments that are uploaded and attached to replies are not working as expected. The files are uploaded correctly and are attached to the tickets parts (id 265 and 266). If we visit the file url then the image works correctly. But on the browser the images are not showing up (as seen in the screenshot).

I am unsure what I am doing wrong?

{
  "type": "ticket",
  "id": "70",
  "ticket_id": "11",
  "ticket_attributes": {
    "_default_title_": "examplecompany@verun.com",
    "_default_description_": "@Services:\nBuilding & Property Wash\n-\n@Rooms:\n\n-\n@Message:\nasdfasdf"
  },
  "ticket_state": {
    "type": "ticket_state",
    "id": "1",
    "category": "submitted",
    "internal_label": "Submitted",
    "external_label": "Submitted"
  },
  "ticket_type": {
    "type": "ticket_type",
    "id": "5",
    "name": "Job",
    "description": "Job",
    "icon": "👷",
    "workspace_id": "#####",
    "archived": false,
    "created_at": 1727322688,
    "updated_at": 1727322688,
    "is_internal": false,
    "ticket_type_attributes": {
      "type": "list",
      "data": [
        {
          "type": "ticket_type_attribute",
          "id": "5323363",
          "workspace_id": "#####",
          "name": "_default_title_",
          "description": "",
          "data_type": "string",
          "input_options": { "multiline": false },
          "order": 0,
          "required_to_create": false,
          "required_to_create_for_contacts": false,
          "visible_on_create": true,
          "visible_to_contacts": true,
          "default": true,
          "ticket_type_id": 5,
          "archived": false,
          "created_at": 1727322688,
          "updated_at": 1727322688
        },
        {
          "type": "ticket_type_attribute",
          "id": "5323364",
          "workspace_id": "#####",
          "name": "_default_description_",
          "description": "",
          "data_type": "string",
          "input_options": { "multiline": true },
          "order": 1,
          "required_to_create": false,
          "required_to_create_for_contacts": false,
          "visible_on_create": true,
          "visible_to_contacts": true,
          "default": true,
          "ticket_type_id": 5,
          "archived": false,
          "created_at": 1727322688,
          "updated_at": 1727322688
        }
      ]
    },
    "category": "Customer"
  },
  "contacts": {
    "type": "contact.list",
    "contacts": [
      {
        "type": "contact",
        "id": "670729f30110ce10006d4400",
        "external_id": "97acc5c1-6618-4952-9c4b-1813886797e6"
      }
    ]
  },
  "admin_assignee_id": "7590886",
  "team_assignee_id": "0",
  "created_at": 1728522740,
  "updated_at": 1728961454,
  "ticket_parts": {
    "type": "ticket_part.list",
    "ticket_parts": [
      {
        "type": "ticket_part",
        "id": "249",
        "part_type": "ticket_state_updated_by_admin",
        "ticket_state": "submitted",
        "previous_ticket_state": "submitted",
        "created_at": 1728522741,
        "updated_at": 1728522741,
        "author": {
          "id": "7524379",
          "type": "bot",
          "name": "Fin",
          "email": "operator+#####@intercom.io"
        },
        "attachments": [],
        "redacted": false
      },
      {
        "type": "ticket_part",
        "id": "264",
        "part_type": "note",
        "body": "",
        "created_at": 1728960736,
        "updated_at": 1728960736,
        "author": {
          "id": "7590886",
          "type": "admin",
          "name": "fname lastn",
          "email": "fname@examplecompany.nz"
        },
        "attachments": [
          {
            "type": "upload",
            "name": "sampleimage.jpg",
            "url": "https://test-domain---official.intercom-attachments-1.com/i/o/#####/1216040056/8675c812172c667f182cf43ae4e8/sampleimage.jpg?expires=1728964800&signature=68775980964a648c35873cde5c69965ce657e881a67609afafc109a96cdf1b01&req=dSImEMl6nYFaX%2FMW1HO4zUE8hfCleBbFmft%2BaivxdX97CcUuLvzcU9Y%3D%0A",
            "content_type": "image/jpeg",
            "filesize": 56229,
            "width": "520",
            "height": "360"
          }
        ],
        "redacted": false
      },
      {
        "type": "ticket_part",
        "id": "265",
        "part_type": "note",
        "body": "<p>Image test</p>",
        "created_at": 1728960973,
        "updated_at": 1728960973,
        "author": {
          "id": "7524379",
          "type": "bot",
          "name": "Fin",
          "email": "operator+#####@intercom.io"
        },
        "attachments": [
          {
            "type": "upload",
            "name": "depositphotos_48410095-stock-photo-sample-blue-square-grungy-stamp.jpg",
            "url": "https://test-domain---official.intercom-attachments-1.com/i/o/#####/1216041968/a4284b6a5609e0c313635dc6d475/depositphotos_48410095-stock-photo-sample-blue-square-grungy-stamp.jpg?expires=1728964800&signature=e660dc30271700ecf240d751a53e3fa5eda5b4250ae18ff5ea543b82117859c4&req=dSImEMl6nIhZUfMW1HO4zUybqi%2BhfuTn4FyD4VXpsupuWzg0nkF3UN0%3D%0A",
            "content_type": "image/jpeg",
            "filesize": 29006,
            "width": null,
            "height": null
          }
        ],
        "redacted": false
      },
      {
        "type": "ticket_part",
        "id": "266",
        "part_type": "note",
        "body": "<p>Image test</p>",
        "created_at": 1728961454,
        "updated_at": 1728961454,
        "author": {
          "id": "7524379",
          "type": "bot",
          "name": "Fin",
          "email": "operator+#####@intercom.io"
        },
        "attachments": [
          {
            "type": "upload",
            "name": "1667.jpg",
            "url": "https://test-domain---official.intercom-attachments-1.com/i/o/#####/1216046205/e8d7eed861b562ddbbd05f931c41/1667.jpg?expires=1728964800&signature=c43e1a34590f91a9e2456497dca361e69d2a8265fb7dcbf6d39101f6ebff13f8&req=dSImEMl6m4NfXPMW1HO4zUd2Bnsz6w8CK3bgCqNJPwbghp%2F7zvIoB%2FE%3D%0A",
            "content_type": "image/jpeg",
            "filesize": 422744,
            "width": "2500",
            "height": "1667"
          }
        ],
        "redacted": false
      }
    ],
    "total_count": 3
  },
  "open": true,
  "linked_objects": {
    "type": "list",
    "data": [],
    "total_count": 0,
    "has_more": false
  },
  "category": "Customer",
  "is_shared": true
}

 

Best answer by bernice

Hi @Krish Patel  👋 Could you try including your images in a note with the following by including an img tag in the body of the note?

{
  "message_type": "note",
  "type": "admin",
  "admin_id": "6611116",
  "body": "<p>Test image: </p><img alt=\"Amazing\" src=\"https:\/\/cdn.simplesat.io\/choice_images\/defaults\/smiley2-5.5300.gif\" width=\"30\" height=\"30\">"
}

Let me know how this goes for you 🚀

View original
Did this topic help you find an answer to your question?

2 replies

bernice
Intercom Team
Forum|alt.badge.img+5
  • Intercom Team
  • 230 replies
  • Answer
  • October 30, 2024

Hi @Krish Patel  👋 Could you try including your images in a note with the following by including an img tag in the body of the note?

{
  "message_type": "note",
  "type": "admin",
  "admin_id": "6611116",
  "body": "<p>Test image: </p><img alt=\"Amazing\" src=\"https:\/\/cdn.simplesat.io\/choice_images\/defaults\/smiley2-5.5300.gif\" width=\"30\" height=\"30\">"
}

Let me know how this goes for you 🚀


  • Author
  • New Participant
  • 1 reply
  • November 4, 2024
bernice wrote:

Hi @Krish Patel  👋 Could you try including your images in a note with the following by including an img tag in the body of the note?

{
  "message_type": "note",
  "type": "admin",
  "admin_id": "6611116",
  "body": "<p>Test image: </p><img alt=\"Amazing\" src=\"https:\/\/cdn.simplesat.io\/choice_images\/defaults\/smiley2-5.5300.gif\" width=\"30\" height=\"30\">"
}

Let me know how this goes for you 🚀



Hello, this works really well but now I am running into a similar issue with PDF files. If i use the image tag it turns into a link and redirects me to a different url rather than attaching the PDF to intercom. Would you have a fix for this issue?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings