Best answer

Write a Zapier function to return IMG binary data


Userlevel 2
Badge +1

Hi everyone,

I would like to write a Zap which responds to GET requests - normal browser stuff; it will be an IMG SRC type of a thing but the Zap needs to do things like call an API; get an image returned (this is a QR code automaton use case) and then return that image back in response to the GET request

The obvious reason for the Zap is that I want to obscure all the internal items such as API key, etc

I can’t do web hooks since that method only returns text in a JSON form with the outcome of the GET call. There must be something else that I am missing.

In summary; the Zap will accept the returned image from another external API and return that image as a response to the end point GET request - that’s what would hit the Zap 

Any ideas will be appreciated

Thank you

Boyan

 

icon

Best answer by Danvers 31 May 2022, 11:13

View original

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

4 replies

Userlevel 7
Badge +14

Hi @bubba198 

Good question.

You’ll need to use frontend JavaScript to achieve returning data in real-time to a website.

Zaps work server side, aka backend.

Userlevel 2
Badge +1

@Troy Tessalone Thank you for the quick reply. Yah I figured that as my plan A and then I won’t need to use Zapier at all but the issue is that I can’t use HTML front-end java script - the end game is MailChimp e-mail and any java script does influence the SPAM score greatly, so the closest I can get to is <IMG SRC=xyz> as to avoid any possible mail client blocking

I was hoping there’s a way to create a Zap which Proxies the data back to the caller; like a bend-pipe concept so if there’s a way to do that please let me know

Thank you 

Boyan

Userlevel 2
Badge +1

So an update for everyone, it was easy to use free API with QR generator and then embed a GET call into HTML but again that’s far from optimal since this code can easily be blocked by scrubbers and other “bad” things based upon the use case of each e-mail client; I am looking for a solution where the Zap would make the calls under the hood and then present the binary PNG image as an end game of the Zap itself…

Thank you

Boyan

Userlevel 7
Badge +12

Hi @bubba198!

If you want a Zap to return the actual image file instead of a link to it, you’ll need to use the developer platform to create what’s basically a private app. The developer platform uses file hydration when working with files (like images) so I think that will do what you need. You can learn more about hydration in this section from our developer documentation.

 

Do you think that would do what you need it to?