Skip to main content

Hello!

So, I wanted to be able to use the webhook function to extract attachments from tickets automatically after a desired trigger action and either save them to a dedicated file destination or send the data to an application to immediately print pdf/xlxs files. I’ve been reading the documentation, but I think the “Using Webhooks” article might be outdated and would appreciate some help to make sure it works as intended.

 

As I understand it, the JSON code would look something like this:

{
"name": "Fetch Email Attachments",
"url": "https://yourserver.com/webhook-handler",
"http_method": "GET",
"headers": {
"Content-Type": "application/json",
"Authorization": "Basic YOUR_BASE64_ENCODED_API_KEY"
},
"payload": {
"ticket_id": "{{ticket.id}}",
"event": "{{event}}"
},
"trigger_on": g
"ticket.created",
"ticket.updated"
]
}

 

However, in the Trigger webhook section I don’t have an option to edit the body, so I can only assume that the website already has the function written and simplifies it for the end user. I can only add custom headers - you can view the screenshot below of a webhook I edited (API Key excluded). I’m having a bit of a hard time wrapping my head around whether the below would work as is to fetch attachments from individual tickets or not since I couldn’t seem to find the right documentation for how webhooks can identify and retrieve attachments.

 

 

Ultimately my questions are: Would the webhook I have shown in the screenshot work as intended and fetch the attachments? If not, what would be the correct way of doing this?

I would appreciate any help or input, thank you!

Hi @NicoleKin,

Greetings from Freshworks Community!

I understand your request to extract attachments from a single ticket. With Webhook triggers, only the Post and Put call will be supported. The Get call is not feasible for this purpose, as it is intended for displaying details rather than performing actions. Additionally, there is no specific endpoint for attachments, but you can retrieve ticket details using 
https://developer.freshdesk.com/api/#view_a_ticket which will also include the attachments.

I am afraid that the above mentioned webhook will not work and there are no other ways to extract the attachments from the UI using API calls. However, you can use this API 
https://developer.freshdesk.com/api/#view_a_ticket to view the attachments from any external tools like Postman.

Hope this helps.

Cheers,
Sneha.


Reply