Webhook to Excel file

Hi there,

I’m trying to build a workflow that start with a web hook, then searches a FileMaker database and converts the search results to Excel. The last node is a Respond to Webhook, where I specified Respond with Binary. I thought that that would iniate the download of the Excel file, but that’s probably too simple …

Anybody knows how to solve this?

Thanks in advance and best regards - Dick

Hey @dickhoning, this should work in principle.

I have set up a similar workflow (using a HTTP Request instead of fetching data from Filemaker) and a file was downloaded as expected in my browser when hitting the webhook URL. Can you confirm what problem exactly you are seeing and share your workflow?

Hi @MutedJam , can you please send me a copy of the workflow you made and that works? Thanks in advance! And here’s my workflow …

can you please send me a copy of the workflow you made and that works

Sure, my workflow is really simple:

Example Workflow

Simply visiting the webhook URL would download the file:

image

I’ll take a look into yours once I have a bit of time :slight_smile:

@MutedJam thanks for your example workflow. And in the meantime, I found the error. My Webhook Node Respond option was set to ‘When last node finishes’ instead off ‘Using ‘Respond to Webhook’ node’ …

1 Like

Even better, thanks so much for confirming!

Hi @MutedJam one more question remaining;

how can I specify the filename and extension on the download file?

Now it actually comes out as .zip. Changing the extension to .xlsx shows that it is actually an Excel file.

Thanks again and best regards - Dick

You can adjust the webhook path. If you set it to something like myData.xlsx, the file would be called myData.xlsx:

image

Hi @MutedJam Tom, you’re the best !!! Works like a charm. Furthermore, I think that the combination of an intuïtive product with good support via a community is the key to success. Keep up the good work!

2 Likes

@MutedJam on second thought, you probably do not want to have this in your public web hook url. Is there another method, for example passing the filename as a variable in the url?

Thanks again and best regards - Dick

@MutedJam think I found it :slight_smile:

1 Like

On more (hopefully last for this workflow) question:

I try to include an option where the filename can be specified in de url passed to the Webhook, as follows:

attachment; filename="{{$node["Webhook"].json["query"]["filename"]? $node["Webhook"].json["query"]["filename"] : "Export"}}.xlsx"

Unfortunately, this does not appear to work as I then get an xlsx.zip file instead of [filename].xlsx.

Any idea what I might be doing wrong?

Hi @dickhoning, I tried this out on my end but would still get the XLSX file when setting the content-disposition header using your expression.

Can you confirm which browser you were using when running into this and share a screenshot of the binary tab of your Respond to Webhook node like below? I am especially interested in the mime type your file has.

@MutedJam when I tried this morning, it worked. Don’t know what changed … shoot me!

1 Like

@MutedJam although this now works fine with Safari on macOS, when I call the same webhook via Chrome, I get 82be0ea4-1c84-4c01-8059-7a03d2260bad.zip instead of Export.xlsx

@MutedJam forgot to send you this …

Looks like in your latest screenshot the content-disposition header you were previously setting is missing, meaning the filename defaults to the webhook path again.

Once I added the header, the file had the expected name on Chrome for me:

Could you verify this on your end?

I think I finally figured out what was wrong. I added the extra ‘content-disposition’ header to the webhook node instead of to the respond to webhook node. Everything now works fine in Safari on macOS, but the filename still defaults to the webhook path when I call this workflow via Chrome on macOS.

Hi @dickhoning, I player around with this some more today but could not reproduce the behavior in Chrome unfortunately (but I don’t have Mac OS so don’t have the exact environment you have).

Maybe there’s a fellow Mac user in the community who could chip in on this, let’s see :crossed_fingers:

@MutedJam thanks very much. I really appreciate you trying to figure this out for me. It’s not really a huge problem right now, as I’m going to use this workflow as a micro service and it looks like it’s working fine when I test this in Postman. Funny though that it works fine in macOS Safari and not Chrome, as this is normally the other way around :grin:

By the way; do you know of the top of your head if there are alternatives for content-disposition attachment; filename … ?