Skip to main content
Question

Create a ticket via the API with inline images

  • 16 May 2024
  • 5 replies
  • 144 views

I need to create tickets via the API that include inline images originally in an email.  I do not just want  them only as attachments - I need to view them inline in the ticket body.  Otherwise, there is little point as it just makes reading the message difficult.  

 

I have tried a number of things with no success:

 

1.) I replace <img src=”cid:somefile.png@1234”/> with <img src=”somefile.png”/> and adding a “somefile.png” attachment to the CreateTicket api.  It appends the attachment but does not render inline.

 

2. I have replaced <img src=”cid:somefile.png@1234”/> with <img src="data:image/jpeg;charset=utf-8;base64,/9j/4AAQSkAUUUxxxUAf/2Q=="/> to inline the image as Base64 and entirely avoid attachments altogether.  The system strips this out and renders it as <img/>

 

If I create a ticket via the UI or even add a note I get the behavior I want which is something like this: <img src="https://attachment.freshdesk.com/inline/attachment?token=xxxxxxxxx" data-id="153010400494">  How do I achieve this via the API?

 

I appreciate any assistance.

5 replies

My team is experiencing the same challenge.

Facing the same issue. 
Hope developers look into this as soon as possible 🙂

Userlevel 2
Badge +5

Hi @GLFJ. Greetings. Thanks for reaching Freshworks community. 

 

I understand that you would like to include inline images in the ticket. You should be able to do so via API within the description tag as shown below.

 

"description":"Test Article <img src='https://snag.gy/0vVeuf.jpg' alt='Smiley face'>",

Can you confirm if  we tried passing it in the description tags as shown above? Please ensure that the image is hosted in a public location. 

 

Kindly try and please keep us posted with the result.

 

Cheers,
Sujitha Dhanaseelan.
Learn something new today, get recognized for your contributions, stay on top of product updates and build meaningful connections in our Freshdesk community. Fresh ideas, quality service.

Badge

The whole point is that I do not want to put images on an external site.  I want to attach them to the posting or inline as described.  Same behavior as if I had the system monitor a mailbox directly.

I found this discussion from a few years ago where it is confirmed that removal of base64 encoded images is intentional. 

https://community.freshworks.dev/t/base64-inline-image-in-freshdesk-ticket-are-removed/3932

The boogeyman of security is blamed, but I think the mailbox monitor happily processes base64 and CID images.  It’s a shame that the API isn’t capable of providing comparable functionality.

Reply