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 -
Does anyone have experience doing the above?
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.
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.
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.
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.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With