Add attachment with the request method

Hi All,

Can we use request method to add attachments? for example, is it possible to create ticket with attachments from custom apps using request method?

Thanks in advance.

1 Like

Hi @Sachin_Kumar

Yes, it is doable if you use the format mentioned below to create tickets.

curl -v -u yourapikey:X -F "attachments[]=@/path/to/attachment1.ext" -F "attachments[]=@/path/to/attachment2.ext" -F "email=example@example.com" -F "subject=Ticket Title" -F "description=this is a sample ticket" -X POST 'https://domain.freshdesk.com/api/v2/tickets'

Thanks.

@hemakumar
Thanks for your reply. We are looking for some example of request method of freshdesk sdk to do so. Please let us know if you can help us with the same.

Please refer to the below link @Sachin_Kumar

Thanks.

@hemakumar

Thanks again but we are aware that we can create ticket using FD API. We are looking for the answer or an example of FDK request method to do so.

Hi @Sachin_Kumar ,

Good day!

I don’t think request method supports multipart form data as of now. While the note in freshdesk API document states

  1. This API request must have its Content-Type set to multipart/form-data .

One thing which you could try is to make use of Server Method Invocation (SMI) to add attachments to the ticket via a HTTP call. This can be invoked from request method.

Please check Freshworks Developer Docs | Freshworks app ecosystem for more details.

Thanks

Hi @mariappan

Thanks for your response. We can achieve adding attachments using axios library from UI however the challenge is to use the secure iparams in axios call.
Also in case of SMI how could we pass file (form data) to be added as attachment on serverless app. Any guidance will be really helpful. TIA

This is one of the most requested feature requests for Request Method, and we don’t support it yet. There have been some discussions internally alongside the need to support larger payloads in Request Method. I will add your ask as a +1 to the feature request internally.

2 Likes

You can access secure iparams inside of SMI functions I guess.
For eg: “https://<%= iparam.domain %>/api/v1/test” should be replaced.

It depends on what external HTTP client libraries like axios, needle and fetch is being used. Check the respective guides.

However, I doubt this could help much in your case due to the current limitations we’ve with SMI (especially the file size). Adding it as a note below for you to validate & choose only if it suits you.

**Notes:**

1. The rate limit for the serverless component is 50 triggers per minute.
2. The payload passed to the severless component should not exceed 100KB.

Thanks

1 Like

Thanks @kaustavdm as this will be really useful

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.