Question

How to get filename from Webhook POST action?

  • 24 July 2021
  • 1 reply
  • 227 views

Hi there,

I’m 99% of the way with this and just need a little more help.

I’ve got a webhook working, that is receiving a multipart/form-data encded POST query from a form I created on my site. One of the fields is a file. This is received correctly by Zapier since it creates a querystring entry for that file (let’s call it “file”).

I want to then upload that file to Pipedrive. At the moment I have two imperfect ways to do this and I’m hoping to find a better one.

Method one is to add a Note and, in the body, include the Webhooks field. In the test it looks like it’s including a hydrate text blob, but the note that appears in Pipedrive has a clickable URL instead. When I click that URL, I the file downloads, presumably from Zapier’s servers, and has the correct name.

Method two is to use the “Attach file in pipedrive” hook, which asks for a file and a filename. But I have no way to extract the filename. I prefer this method since it doesn’t rely on Zapier continuing to host the file upload (I don’t know how long they keep the hydrate link online for). But since I don’t know the filename there, and files from that form might come in multiple formats (expecting PDF and PPT mostly)), I end up getting a file without an extension, which is not great from a useability perspective. I can work around that by downloading the extension-less file and adding the extension myself.

So, the question is:

In this situation, is there a way to extract the filename from the querystring object that contains the file?

Thank you for any help.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +14

Hi @swombat 

Is there a data point in the webhook data that includes the file name?

Perhaps you can provide a screenshot.