Skip to main content
Best answer

Write a Zapier function to return IMG binary data


bubba198
Forum|alt.badge.img+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

 

Best answer by Danvers

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?

View original
Did this topic help you find an answer to your question?
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

Troy Tessalone
Forum|alt.badge.img+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.


bubba198
Forum|alt.badge.img+1
  • Author
  • Tinkerer
  • 18 replies
  • May 18, 2022

@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


bubba198
Forum|alt.badge.img+1
  • Author
  • Tinkerer
  • 18 replies
  • May 30, 2022

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


Danvers
Forum|alt.badge.img+12
  • Zapier Staff
  • 3731 replies
  • Answer
  • May 31, 2022

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?