Iterate Mailchimp API data

I would really like to get a handle on iterating API data requests.

I've looked at a few examples here but they don't quite match my use case because they all use oauth, while I'm using API auth.

Here is my use case:

The events team send out a Fundraising Army newsletter every quarter. I want to ask Mailchimp to display the recipients of each of these newsletters. There is a limit of (I think) 1000 records per request but the number of recipients will vary each time.

I would also like an alternative to offsetting the list of campaigns, which currently looks like this:

Please can someone help?

Thanks in advance.

Nike

Check out this article:

Thank you very much for this.

I have come back to this today but I am still struggling with this example.

I can successfully run the Get Page module, alone (via Run Action), pull data through and parse my desired JSON fields but I can't get it to repeat.

The reason could be:

  1. because I 'bury' all my code in connectors and parameters which that I can call them from anywhere in my modules. My base URL is in a connector and my URL parameters are often called from stored Easymorph parameters. With this example, I'm needing to unfold and deconstruct my stored Easymorph parameters, to get to the API parts
  2. because I'm completely unfamiliar with Pokemon (without needing to take a crash course). In my use case, I am interrogating our digital marketing platform - Mailchimp, so my references are campaign names, campaign date, list name, lsist_id, campaign_subject, email_id, opt_in_date, opt_out etc

Screenshots of my errors:

image

Do you have any other marketing based examples?

Hi Nike,

Sorry for the late reply. We will prepare an example of pulling contacts from Mailchimp and publish it here.

That's very much appreciated.

Thank you.

Hi Nike,

Here is the example project:
MailchimpPagingExample.morph (12.6 KB)

To make it work, you must set your API key as a password in the connector settings and specify your campaign ID as a parameter.

The tricky parts of this task are:

  • generating a correct offset value for each call
  • detecting the first "empty" response

The former is achieved by passing the [offset] column between the executions of the Query API module and increasing that number by the number of requested recipients after each execution. The [offset] column is removed from the final result in the Main module.

The latter is achieved by checking the existence of the sent_to{*} in the "Parse JSON" action results. That column will appear only when the response doesn't have any recipients. There might be better alternatives to this method, but I decided to go with this one to avoid overcomplicating the example.

When the "Skip actions on condition" action detects the presence of the sent_to{*} column, it will return an empty dataset. That will make the "Derive table" action in the "Result" table disable all the actions and return an empty dataset, which will make the "Repeat" action in the main project stop executing the "Query API" module and return the combined result. An empty dataset will be returned if the specified campaign has no recipients.

I hope this helps.

Thank you for this.

I actually already have all my connectors and parameters configured, which include API keys, date parameters, count etc.

I am able to successfully, manually, call any of the endpoints, the standard way, by creating a daisy chain of offset tables

BUT I want to automate and replicate for different products.

An unknown number of emails will be sent, per product, on various dates and from multiple lists which means that I can't predict the number of records and hence, the iteration value.

Ideally, I would like to have one flow per product, which I can run on a set day each month, with limited manual input (and ideally using EasyMorph launcher). This means that I won't know the campaign ID, from month to month, so it doesn't work as a parameter, without launching the project AND making manual tweeks that generate the list_recipents endpoint.

To give you some context, some of our products and the numbers are:

  1. Charity newsletter - from the Master List and just under 4000 recipients

  1. Charity Shop newsletter - has it's own list and just under 4000 recipients

  1. Fundraising Army newsletter - from the Master List, numbers vary, but:

  1. Event Volunteers newsletter (own list)

Once I have cracked the above, I would also like to replicate this model (or similar) with one of our Event Registration platforms that is limited to 100 records per call :frowning: .

Is there a way to securely share one of my Mailchimp workflows with you? :thinking:

Sure. You can send it to support@easymorph.com