Mailchimp Api For WordPress

Mailchimp Api For WordPress is a premium plugin that provides you the power to integrate Mailchimp with your WordPress site in few steps. This plugin allows you to design lots of features such as Automation & Subscription Forms, A/B Testing, Analytics and much more. By using this premium Plugin, you can help your subscribers connect their social profiles including Yahoo! Mail, Gmail, AOL & Hotmail

Mailchimp Api For WordPress

  1. On the Plugins page, click Settings under Mailchimp.
    Image: a screenshot of the settings link for Mailchimp's plugin.
  2. Paste your Mailchimp API key into the field, and click Connect.
    image: a screenshot of the connect page for the plugin
    To complete this part of the process, you’ll need a Mailchimp API Key. Find out how to generate a new key in About API Keys.
  3. Click the Select A List drop-down menu, and choose which Mailchimp list to connect to.
    image: a screenshot of the settings page, where you select your mailchimp list
  4. Click Update List.
  5. In the provided sections on the Setup page, customize your form settings.
  • Content Options: Customize the text of your form’s header, subheader, and submit button.
  • Remove CSS : Disable Mailchimp’s CSS (advanced option).
  • Custom Styling: Edit the border, color, and text of your form.
  • List Options : Enable Referral program, JavaScript support, and double or single opt-in.
  • Merge Fields Included : Choose to show or hide certain Mailchimp fields from your signup form.
  • Group Settings : Show or hide Mailchimp group options.
image: a screenshot of wordpress form settings
  1. After you update each section on this page, click Update Subscribe Form Settings.

Your signup form is now customized, and you’re almost done!

Place widget on your site

After you customize your form, we’ll add a Mailchimp Widget to the Appearance section of your Admin Panel. Decide where you want the form widget to appear, and drag and drop it to your site. You’ll only need to do this once.

To place your form widget, follow these steps.

  1. In the left sidebar, navigate to Appearance, and click Widgets.
    Image: a screenshot of the wordpress menu, with the cursor clicking appearance and choosing widgets.
  2. Drag the Mailchimp Widget into one of your widget areas, like your sidebar or footer, and click Save.
    image: a screenshot of the Mailchimp widget area in wordpress.

You’re all set! Now your WordPress visitors can sign up for your Mailchimp newsletter.

Disconnect List Subscribe for WordPress

If you ever need to disconnect the plugin, you can do it anytime. Disconnecting removes any Mailchimp form widgets from your site, but does not affect your Mailchimp list or subscriber data.

To disconnect List Subscribe for WordPress, follow these steps.

  1. Log in to your WordPress Admin Panel.
  2. Navigate to Plugins, and click Installed Plugins.
    image: a screenshot of installed plugins in wordpress.
  3. Search or scroll to locate Mailchimp, and click Deactivate.
    image: a screenshot of the deactivate link
  4. After the page refreshes, search or scroll to locate Mailchimp, and click Delete.
    image: a screenshot of the delete link.
  5. On the Delete Plugin page, click Yes, delete these files.
    image: a screenshot of the Delete Plugin page for List Subscribe for WordPress.

The List Subscribe for WordPress plugin has now been removed.

If you want to try another type of form, read about all the options available for Mailchimp signup forms.

Technical Support

Have a question?

Paid users can log in to access email and chat support.

mailchimp api example

HTTP methods

The Mailchimp Marketing API accepts the standard HTTP methods: GET, POST, PATCH, PUT, and DELETE.

  • Make a GET request to retrieve data. GET requests will never cause an update or change to your data because they’re safe and idempotent.
  • Use a POST request to create new resources. For example, make a POST request to a collection endpoint where the body of your request JSON contains all of the required information about the new object to be added to the collection.
  • Make a PATCH request to update a resource. With PATCH requests, you only need to provide the data you want to change.
  • Use a PUT request to create or update a resource. This is most useful for syncing contact data.
  • Make a DELETE request to remove a resource.

Some endpoints act on resources outside of a traditional REST approach. To pause an automation workflow, for example, you make a POST request to /automations/{workflow_id}/emails/{id}/actions/pause. Where we deviate from the verb usage defined by REST, we namespace those verbs under actions in the URI.

If your firewall rules do not support HTTP methods like PATCH or DELETE, use the X-HTTP-Method-Override header. Make your call using the POST method and pass the unsupported method as the value of X-HTTP-Method-Override. The override will not work with any method other than POST; if you use the override header with GET, PATCH, PUT, or DELETE, you will receive an error.

Note: You won’t need to worry too much about these implementation details if you’re using the official client libraries.

Request body parameters

For PATCH, PUT, and POST requests, you may need to include a request body in JSON format. The API reference details all the available request parameters for each endpoint, including required fields. 

Response body parameters

Every API call response includes headers and an optional JSON-formatted body. DELETE requests always return only headers without a JSON body; this could cause issues if your JSON parser does not handle empty responses well. Additionally, the 204 No Content error does not include any JSON body content. The API reference details the specific response for each API call.

Path parameters

In an API URL, resource names and unique identifiers help you figure out how to structure your requests. Resource names are immutable, but resource identifiers need to be replaced with real values from your Mailchimp account. Resource identifier placeholders are indicated in curly brackets throughout this documentation.

Resources can be nested several levels deep in a path, such as https://<dc>.api.mailchimp.com/3.0/lists/{list_id}/members/{subscriber_hash}/notes/{id}. In this example, there is one primary resource, lists, and two subresources, members and notes. There are also three different path parameters that you need to replace with real values from your Mailchimp account: list_id, email_id, and id. When you replace those values with actual data, your final URL should look something like this:

Note: We refer to some endpoints by name and others by URI. For example, you can find a collection of reports at the Reports endpoint, or individual reports at the /reports/{campaign_id} endpoint.

When making a call for information about a particular contact, the Marketing API uses the MD5 hash of the lowercase version of the contact’s email address. We use the MD5 hash because it makes it less likely to leak email addresses—these hashes can’t be translated back to an email address, so if your APIs calls were leaked in some manner, your users’ email addresses remain unexposed. 

You also don’t need to maintain a mapping from your contact to Mailchimp’s internal contact ID in your application’s data store or make additional calls to the API to look up that mapping. Simply calculating the MD5 hash of the lowercase version of your user’s email address allows you to use the email address as a canonical identifier that’s shared across your data model and Mailchimp’s. 

Query string parameters

We use optional query string parameters for filtering, pagination, and partial responses in the Mailchimp API. The format for query string parameters is the full resource URL followed by a question mark and optional parameters:

Filtering resources

There are two ways to limit the size and complexity of the responses to your API calls: pagination and partial responses. The API reference shows you which resources you can filter on, and what to include in your URL query string. If you provide multiple filters, the Marketing API only returns resources that match all filters.

Pagination

You can paginate your API requests to limit response results and make them easier to work with by requesting manageable chunks of data. We use offset and count in the URL query string to paginate because it provides greater control over how you view your data.

Note: The Marketing API has a 120-second timeout on API calls. If you’re requesting a particularly large set of data, pagination can help cut down on request times. Alternatively, you might consider sending long-running requests to the Batch endpoint.

The maximum value for count is 1000; the default value is 10. If not included, offset defaults to 0. (To retrieve the first ten results, set count to 10 and offset to 0. To retrieve the following ten results, the offset should be 10 and the count should remain 10.) This URL represents the default query string parameters for pagination:

Partial responses

Use the fields or exclude_fields parameter to cut down on response size by limiting which fields the Marketing API returns. You may not need the full details of a resource, and can instead pass a comma-separated list of specific fields you want to include or exclude. 

If your calls are failing to return the correct fields, make sure that your request exactly matches the structure of the response JSON, which is determined by the particular endpoint you are accessing. Any nested fields are referenced by dot notation.

For example, the following URL uses the fields query string parameter to only include the audience name (lists.name) and ID (lists.id) fields in the response:

However, if you wanted to return just the name of a specific audience, you would do so with the /lists/{list_id} endpoint and the audience name field should be referred to as name, like this:

This is because response for this endpoint returns a differently structured JSON object—name is at the top level, not embedded in another object named lists

Leave a Comment