Best answer

How to build a workflow that automates mailgun api get requests for multiple domains

  • 25 November 2020
  • 4 replies

Hi Zapier Community,

Would be grateful for any pointers!

We want to automate a monthly api request to Mailgun to GET stats for multiple domains.

Ultimately we want to get stats data for all domains in to snowflake but a spreadsheet would be fine for now.

Mailgun Support says that each request can only take one domain but that they do have customers who use Zapier to automate the request on multiple domains to save having to spend lots of time running a separate request for each domain.

Haven’t used Zapier at all before so it would be really great to get some ideas from the community.


Kulea (EJ)





Best answer by andywingrave 6 December 2020, 22:30

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 +12

It sounds like you’ll need a Zap that starts with the Scheduler app (to trigger the Zap once a month) and then use webhook steps to call the Mailgun API to get the data that you need. 

I’ve not worked directly with the Mailgun API so I’m not sure exactly how you’d need to set up the webhooks, but I do know that you’d need to do it that way rather than using the Zapier Mailgun integration. 

Userlevel 7
Badge +10

Paging @ikbelkirasan 

Thank you 

Userlevel 7
Badge +9

Hello! There are three ways you’d be able to do this.

First Solution

The most simple way would be to chain several post requests as webhook steps, but honestly - If you don’t run into issues here, I’d be surprised. 

Second Solution

A better way to do this (and it would definitely be dependent on the actual number of services you want to make a call to) would be using a fetch API call in a JavaScript code step

const res = await fetch('/<domain>/messages' + inputData.zipCode + ',us'); const json = await res.json(); return json;

Some resources on this would be here:

and here:

Third Solution

Alternatively, if you don’t want to get too technical, you could just sign into as many accounts as you need in Zapier here: and create an indivuidual zap for each account and send it to a database/G-Sheet.

Hope any of these ideas help you - Please let us know how you get on!