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:
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:
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
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
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.
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:
Charity newsletter - from the Master List and just under 4000 recipients
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 .
Is there a way to securely share one of my Mailchimp workflows with you?