Thursday 15 April 2010

php - Drupal + Mailchimp API : create campaign with an existing template -



php - Drupal + Mailchimp API : create campaign with an existing template -

i'm trying create campaign mailchimp php api in custom drupal module, fail utilize existing template.

i sure of template id in request, id 0 in response.

what right request payload reuse template ?

i want reuse simple template. now, there's no specific text campaign, i'll seek insert text pattern when i'll able utilize right template.

thanks in advance.

here current code :

function mymodule_templates_list() { $mailchimppath = realpath(__dir__ . '/../../libraries/mailchimp'); require_once $mailchimppath . '/src/mailchimp.php'; require_once $mailchimppath . '/src/mailchimp/templates.php'; $mailchimp = new mailchimp('my-api-key'); $templatesservice = new mailchimp_templates($mailchimp); $list = $templatesservice->getlist( array( 'user' => true, 'gallery' => false, 'base' => false, ), array( 'include_drag_and_drop' => true, ) ); dpm($list); // verify template id $campaignservice = new mailchimp_campaigns($mailchimp); $response = $campaignservice->getlist(); dpm($response); $options = array( "list_id" => 'my-list-id', // ok, right list used in response "subject" => "my subject", // ok "from_email" => "mymail@dev.null", // ok "from_name" => "site name", // ok "to_name" => '', 'template_id' => 123456, // ko : 0 in response ); $content = array( "text" => "dunno utilize here", "url" => 'dunno utilize here', "archive" => "dunno utilize here", ); $response = $campaignservice->create('regular', $options, $content); dpm($response); homecoming ''; }

php drupal-7 mailchimp

No comments:

Post a Comment