MailChimp form with single opt-in (API)

by Snoopp
2 replies
  • WEB DESIGN
  • |
How to easily make MailChimp API form without double opt-in?

Using their API is hard for people with no coding skills and 3rd party tools like POWr or Privy don't have option to disable MailChimp double opt-in.
#api #form #mailchimp #optin #single
  • Profile picture of the author aronprins
    Hey Snoopp,

    From what I read online, it's not possible to do without custom coding.

    Your best bet would be contacting the platforms you use and as them to build this into their system if you can't do it yourself, or (no pun intended) hire a developer

    Hope this helps!
    Cheers,
    Aron

    Disclaimer: Not a MC user myself so can't verify 100%.
    {{ DiscussionBoard.errors[10953112].message }}
  • Profile picture of the author andreiluca
    Here's a PHP example of using the API without the wrapper, you can use with ajax or just a simple html form. Endpoint (us1) might be different on your account.

    <?php
    $apikey = '';
    $listid = '';
    $email = '';
    $name = '';
    $endpoint = 'https://us1.api.mailchimp.com/2.0/lists/subscribe';
    $email_struct = new StdClass();
    $email_struct->email = $email;
    $request = array(
    'apikey' => $apikey,
    'id' => $listid,
    'email' => $email_struct,
    'double_optin' => false,
    'send_welcome' => false,
    'merge_vars' => array(
    'FNAME' => $name,
    )
    );
    $curl = curl_init($endpoint);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($request));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($curl);

    ?>
    [/code]
    {{ DiscussionBoard.errors[10953669].message }}

Trending Topics