Skip to main content

In my Zapier App - that’s Fattura24, I would like to add an action called ‘GetFile’.
First of all y add an Input field in which I could enter a document Id;

then I call my API in a way like this:

endpoint: URL: https://www.app.fattura24.com/api/v0.3/GetFile

params: { apiKey: xxxxxxxxxx,

              docId: 123456 }

 

The result of this call is actually a PDF file identified by docId.

I would like to build a method by which the user can download (or prompted to do so) the file in his desktop. Any suggestion?

Thanks to all

Hi @Davide - While this might not be possible with a custom integration action, you might want to consider the following options:

  • Build a zap that saves the file to the user’s Dropbox (or Google Drive etc..) folder that’s automatically syncing with their computer.
  • Build a zap that sends them the download link in an email or in a Slack message.

Actually I need only something like opening an URL in a new browser tab, with a string like this  in address bar:

 

https://www.app.fattura24.com/api/v0.3/GetFile?apiKey=xxxx&docId=123456

 

any suggestion?


@Davide The problem here is that Zapier doesn’t work in Request-Response fashion so you can’t actually respond to HTTP requests with a custom response.


Hi @Davide - While this might not be possible with a custom integration action, you might want to consider the following options:

  • Build a zap that saves the file to the user’s Dropbox (or Google Drive etc..) folder that’s automatically syncing with their computer.
  • Build a zap that sends them the download link in an email or in a Slack message.


At last I solved by adding two steps in my Zap:

  1. Zapier webhooks to post my request;
  2. Email by Zapier to send the result of the previous step as attachment

Thank you very much for your support


@ikbelkirasan 
Now I’d like to build my GetFile action in a way that its result looks like the result I get by using Webhooks, that is the object ‘File’ ?

 

I tried to add this in my scripting:

 

 // Action 'Get File'
get_file_pre_write: function(bundle)
{
var pjson = require('package.json');
var fields = bundle.action_fields_full;
var keys = Object.keys(fields);
var docId = fields docId];
var apiKey = bundle.request.params.apiKey;

bundle.request.params =
{
apiKey: apiKey,
docId: docId,
source: 'F24-Zap ' + pjson.version
};
return bundle.request

},

get_file_post_write: function(bundle)
{
return bundle.response;
},

When I test this code as a result I don’t get the File


@Davide Unfortunately, I haven’t built app in the Legacy Web Builder. However, it might be useful to look at this example app: https://github.com/zapier/zapier-platform/blob/master/example-apps/files/triggers/newFile.js