Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating MailChimp with Django User Workflow

I'd like to leverage the richness of mailchimp (email template design, analytics, etc) on a Django project I'm working on.

I want to essentially use Mailchimp for all email communications - new user registration on the site, forgot password, newsletters, reminders, etc.

The issue I have is that Mailchimp is very much list and campaign oriented. I'm not sure how to achieve the things listed above with the mailchimp workflow.

What I want to do is something like -

  1. Setup a specific email in mailchimp, such as the 'forgot password email'
  2. When a user forgets their password, I want to trigger mailchimp to send the specified mail

Does anyone have experience doing the above?

like image 840
Steve Avatar asked Mar 14 '14 22:03

Steve


People also ask

What should I consider when building an integration with MailChimp?

When building your integration, consider surfacing errors from the Mailchimp API to your end users. This may help them fix issues in their Mailchimp account on their own or find the right support channel. You should also log and monitor the errors you receive from the Mailchimp API and adjust your code if any are persistent.

How do I authenticate users of my integration with MailChimp?

To authenticate users of your integration with Mailchimp, you should use OAuth 2. OAuth is more secure than traditional API keys, and it’s a requirement to join the Integration Partner Program and have your integration listed in the Marketplace.

How do I integrate my CRM with MailChimp?

You can build an integration to do things like import data from a CRM into Mailchimp, connect e-commerce customers and orders, or sync files like photos to use in campaigns. Once you’ve built your integration, you’ll want to get it in front of Mailchimp users. To do so, you’ll need to join the Integration Partner Program.


2 Answers

There is a Python API client for MailChimp that may be worth a look.

However, MailChimp's terms and conditions actually forbid you from doing this (see http://apidocs.mailchimp.com/api/how-to/transactional-campaigns.php). For that, you would need to use something like Mandrill, which is a transactional email service offered by Mailchimp. There is an API client library for that too at https://pypi.python.org/pypi/mandrill/, and it looks like there are a few third party libraries too.

like image 193
Matthew Daly Avatar answered Nov 02 '22 02:11

Matthew Daly


First, you have create an account on MailChimp, create the List there, and thereafter get the List Key and API key of your account.

Install the package to integrate MailChimp into your Django site

pip install mailchimp

Then send a request to connect with your list in MailChimp

import mailchimp

API_KEY = <<Your MailChimp API Key>>
LIST_ID = <<Your List Key>>
api = mailchimp.Mailchimp(API_KEY)
api.lists.subscribe(LIST_ID, {'email': '[email protected]'})

For a detailed explanation and integration step by step, follow this tutorial: https://djangopy.org/package-of-week/how-to-integrate-mailchimp-on-django-to-increase-subscribers/

like image 23
Jai Singhal Avatar answered Nov 02 '22 02:11

Jai Singhal