Hi all,

At the moment i'm using Mailchimp to send newsletters, so i have a list made in Mailchimp with all my susbcribers.
I got the Mailchimp module installed on my Drupal website and connected it to Mailchimp.com via the API key.

But what i wan't to know is some .php code what can connect to the Mailchimp list, so i can write something that displays five random people from that list (it's for a monthly lottery).

The only thing i would like to know if it is possible to connect to the list of subscribers at mailchimp (and how).
I think it must be possible, since the drupal mailchimp module does it ?

Any help very mutch appreciated.

Grts!, Samuel

Comments

SamDrupal-1’s picture

Found some more info but can't yet figure it out.
So I will need my List ID (wich i have).

And i found some code here that could display just the list.
But i have no idea on how to integrate it.

http://stackoverflow.com/questions/5256375/how-do-i-pull-the-subscriber-...

http://apidocs.mailchimp.com/api/rtfm/lists.func.php

WorldFallz’s picture

Don't know if mailchimp exposes any data to views, but if it does, you should be able to make a list random users in views using the 'global: random' sort option and then limit that view to 5 items.

SamDrupal-1’s picture

Hi thx for the reply.

I got another reply on a post i made at the mailchimp module message board.
There someone says that Mailchimp does not import the list to the drupal website.
So i don't think that views is a option.

http://drupal.org/node/1420336

I'l have to actually be able to connect to the database at mailchimp.

This module does not store locally (in Drupal) a list of all users in a given list. Technically, that info may be living in the Drupal cache, but it's for general consumption. You'll have to the use MailChimp API directly to get at this. Use the core mailchimp.module to help you connect and interact with the API.

Thx!,
Grts!,
Samuel