Forum

Thread tagged as: Suggestions, Third-party, MailChimp

Mailchimp list import – add a count parameter to list API call?

As far as I can tell, the Mailchimp addon does not use a count parameter when fetching lists from the Mailchimp API, resulting in 10 items being fetched. I guess that’s the default count — judging from the 2.0 API docs it used to be 25 (with a max of 100), but I can’t find any docs on defaults or max params in the 3.0 docs.

I hacked around it for now by changing line 23 in PerchMailChimp_Lists.class.php to read:

$lists = $MailChimpAPI->get("lists", array('count'=> 100));

...which fetched all lists plus triggered some nice pagination in the Perch admin, so that seems to work fine.

Emil Björklund

Emil Björklund 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You shouldn't use the v2 version any more. The v3 version pulls in the items page by page, or will prefetch them if you have scheduled tasks configured.

I may be misunderstanding, but I am using the v3 version (just downloaded it, v.3.0.1). It was only showing 10 items on the Lists page, with no pagination, by default. When I added the count parameter per above, it got all lists + showed pagination.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It loads a page at a time. The schedule task will load the others, or you can refresh the page to load in the next page.

Hm, must have been stalling the syncing somehow then. (waited, refreshed several times etc, but no pagination showed up). Anyway, ignore this thread then. Cheers! :-)

Hello,

I've run into the same thing I think - Subscribers and Campaigns work as discussed above (new data comes in if you refresh/click through the pagination) but lists don't seem to.

The Mailchimp account I've connected Perch to has multiple lists, but Perch is not pulling in more than the first 10, as per their API's default count limit.

My testing list isn't in the first 10, so when my Perch form tries to subscribe to my list, with SELECT * FROM perch2_mailchimp_lists WHERE listMailChimpID='LIST_ID_HERE' LIMIT 1 it can't find that list in the Perch database and so doesn't try to contact the Mailchimp API and do the subscription.

I've got it working temporarily using the same edit to PerchMailChimp_Lists.class.php as mentioned above - after Perch knows about all the lists, it all works just fine.

I'm on Perch Runway 2.8.34, and the Mailchimp app is 3.0.1. PHP is 5.6.29.

So far I'm only testing locally, not on a live server.