How to Automate Sending Passwords with MailChimp After Subscription

There are some cases where you want to grant access to password protected content for those who have joined your email list.

In this article, we will walk you through the following steps to send passwords automatically once a visitor subscribes to your MailChimp list.

  1. Configure PPWP MailChimp Integration
  2. Create a MailChimp Audience
  3. Add PPWP fields to MailChimp template
  4. Create signup form linked to your MailChimp list

Requirements:

Configure PPWP MailChimp Integration

Add MailChimp API

Once activating our plugins, go to Settings >> PDA MailChimp Integration from your admin dashboard.

Then insert your MailChimp API keys to connect your MailChimp account with our plugins.

Define PPWP values

Our plugins need the following information to grant access to your password protected content:

  • PPWP_PROTECTED_POST defines which content you want to grant access based on post_id
  • PPWP_PROTECTED_CAT defines which category you want to grant access based on category_id (required PPWP Access Levels extension)
  • PPWP_PWD_EXPIRY (optional) defines the number of days before the password expires
  • PPWP_PWD_LIMIT (optional) defines the maximum number of times the password is used

Let’s say you want to grant access to a category with id 1 and the password will expire after one time of usage or one day from subscription, you will define these values under your wp-config.php as below:

define( 'PPWP_PROTECTED_CAT', 1 );
define( 'PPWP_PWD_LIMIT', 1 );
define( 'PPWP_PWD_EXPIRY', 1 );

Create a MailChimp Audience

Navigate to Audience page from your MailChimp Dashboard, then click on “Create Audience” button to generate a MailChimp list.

Create PPWP webhook

Go to Settings >> Webhooks from your Audience Dashboard.

You will see the image below if you haven’t created any MailChimp webhook before. Simply click on “Create New Webhook” button to generate a new one.

In order to create a webhook, you are required to (1) insert a Callback URL where you want to send webhook requests and (2) select which events triggering the webhook.

Your Callback URL need to follow this format:

https://your-website/wp-json/pda-mkt/v1/mailchimp/webhook

If you want to send passwords to your new subscribers, you should untick all options except Subscribes under “What type of updates should we send?”.

Create PPWP fields

Go to Settings >> Audience fields and *|MERGE|* tags from your Audience Dashboard.

Click on”Add A Field” at the bottom of this page to create a new field.

Select “Text” type and insert 2 fields below:

  • PPWP_PWD refers to password which will be sent to the subscriber
  • PPWP_PROTECTED_URL refers to the protected content (category) URL

Click “Save Changes” to save these fields.

Add PPWP fields to MailChimp template

After creating PPWP fields, you need to add them to your email template. To do so, click the Merge Tags drop-down menu on the editor toolbar and select which one you want to add.

Your email template should look like as below:

Create a Signup form linked to your MailChimp list

Finally, you need to create a signup form allowing your visitors to join your email list. You can display MailChimp form in your WordPress website using form URLs, embedded forms or form plugins.

So once a visitor subscribes, they will receive a welcome email containing a password and URL to access your protected content.

You can also see this password and its related information from PPWP configuration popup.

Using PPWP Statistics if you want to know who has accessed your private content with these passwords and when they do it.

Lasted updated on March 14, 2020