MailChimp

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

MailChimp

Post by AbleMods » Mon Mar 23, 2015 5:01 am

I built an integration to MailChimp this weekend in Able Gold. It was surprisingly easy to do.

Having this standard in AbleCommerce Gold would benefit some of my clients. You might want to post a feedback link if there's a vote pending for this sort of integration. I bet there are others out there that would enjoy having this integration.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
Shopping Cart Admin
AbleCommerce Admin
AbleCommerce Admin
Posts: 3055
Joined: Mon Dec 01, 2003 8:41 pm
Location: Vancouver, WA
Contact:

Re: MailChimp

Post by Shopping Cart Admin » Mon Mar 23, 2015 7:38 am

Howdy Joe,

It's been requested and we've looked into it as well. The full integration with ecommerce tracking is a bit more work, I'm not sure if you went that far. But we really like mail chimp and have been toying with it for some time.

http://ablecommerce.uservoice.com/forum ... -for-email
Thanks for your support

Shopping Cart Guru
AbleCommerce.com
Follow us on Facebook

rmaweb
Commander (CMDR)
Commander (CMDR)
Posts: 118
Joined: Fri Sep 10, 2010 9:41 am

Re: MailChimp

Post by rmaweb » Mon Mar 23, 2015 10:38 am

Hello Guys,

I of course wholeheartedly support any attempt to open up the ablecommerce mail/marketing system up for integration with MailChimp and other email marketing platforms. I did submit the request for MailChimp in the uservoice forum, but I think that the architecture for such an integration should be built around the idea building the integration like an API so that other platforms, like Constant Contact, can be added down the road with minimal extra effort. Maybe expose email marketing and the system email platform as services like Payments, Shipping, and Taxes.

Joe, if you have a link to your site with the product page of your integration, I would love to check it out.
Ryan A.
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: MailChimp

Post by Katie » Mon Mar 23, 2015 4:29 pm

Me too! Do you have any documentation? I'm curious how this integrates with AC. I've used Mailchimp before and it is a fun and easy to use application.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: MailChimp

Post by AbleMods » Tue Mar 24, 2015 1:47 am

I appreciate all of the enthusiasm. There really isn't much to it. The end goal of the integration is to simply subscribe Able users to MailChimp lists during specific events.

To start, I installed the MailChimp .Net wrapper using the NuGet package installer in Visual Studio:

Code: Select all

Install-Package MailChimp.Net
Once the dependencies were resolved, the MailChimp API is now in your project. The next step was building a configuration page. We needed a store-wide place to keep the MailChimp API key and identify the default MailChimp subscribe list. So I built a small custom settings page to go in the Admin Configure menu:
Capture.JPG
The values for these settings are stored in Token.Instance.Store.Settings.

Next, a small helper class was built in /App_Code/ to handle the settings and expose an easy way to make the calls to MailChimp:

Code: Select all

using CommerceBuilder.Common;
using CommerceBuilder.Stores;
using CommerceBuilder.Users;
using MailChimp;
using MailChimp.Helper;

namespace AbleModsHelper
{
    public static class MailChimp
    {

        public static string ApiKey
        {
            get { return Token.Instance.Store.Settings.GetValueByKey("MailChimpApiKey");  }
            set
            {
                StoreSettingCollection settings = Token.Instance.Store.Settings;
                settings.SetValueByKey("MailChimpApiKey", value);
                settings.Save();
            }
        }

        public static string DefaultListId
        {
            get { return Token.Instance.Store.Settings.GetValueByKey("MailChimpDefaultListId"); }
            set
            {
                StoreSettingCollection settings = Token.Instance.Store.Settings;
                settings.SetValueByKey("MailChimpDefaultListId", value);
                settings.Save();
            }
        }

        public static SaveResult SubscribeUser(int userId)
        {
            User user = UserDataSource.Load(userId);
            return SubscribeUser(user, DefaultListId);
        }

        public static SaveResult SubscribeUser(int userId, string listId)
        {
            User user = UserDataSource.Load(userId);
            return SubscribeUser(user, listId);
        }

        public static SaveResult SubscribeUser(User user)
        {
            return SubscribeUser(user, DefaultListId);
        }

        public static SaveResult SubscribeUser(User user, string listId)
        {
            // validate user object
            if (user == null)
            {
                return SaveResult.Failed;
            }

            // start a MailChimp connection
            MailChimpManager mc = new MailChimpManager(ApiKey);

            //  Create the email parameter
            EmailParameter email = new EmailParameter()
            {
                Email = user.LoweredEmail
            };

            // tell MailChimp to add the user
            EmailParameter results = mc.Subscribe(listId, email, null, "html", true, true);

            if (results != null && results.Email == user.LoweredEmail)
            {
                return SaveResult.RecordUpdated;
            }

            // something went wrong
            return SaveResult.Failed;
        }
    }
}
Having the helper class makes the rest of the implementation a snap. Anywhere an new user is added to Able, simply add the following code. The helper class accepts either a userId value or an entire User object. In the example below, the code is added at the end of void CheckedOut() in the OnePageCheckout control.

Code: Select all

            // BEGIN MOD: AbleMods.com
            // DATE:  03/21/2015
            // subscribe the user to MailChimp
            AbleModsHelper.MailChimp.SubscribeUser(currentUser);
            // END MOD: AbleMods.com
This was also done in the Admin People->Users page when a new user is added. As well as in the RegisterDialog control found in /ConLib/.

This client did not have full source code. So a full replacement of Able's MailingList feature wasn't possible. Ideally, I would have replaced the entire low-level implementation with suitable MailChimp calls.

Email marketing in Able has always been a challenge. I totally agree having a "MailingListProvider" implementation would be an excellent improvement to Able. As more and more cloud SaaS implementations come onto the market, having a provider-based implementation would make supporting these new SaaS products much easier and faster in Able.

Note this code is from AbleCommerce 7 however it is easily adapted to Able Gold by updating the Token.Instance references to the newer AbleContext.Current context model.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Tue Aug 22, 2017 1:16 pm

I need to have Constant Contact integrated. Does anybody know how to do it? Does somebody want to do it and how much would it cost. I am sick and tired of waiting for AC to get up to speed with the things that have been kicked around for years. I am serious about my business. It's more than just a hobby. I'm willing to pay to have it done, depending on how much it would cost. I don't believe it is a big deal. Joe said he did MailChimp over the weekend. But if it is a big deal, I may have to switch platforms. There is so much AC just won't do. Please, if anybody is interested, tell me how much. I have other customizations I want to do too, but this is first.
Contractor's Solutions
www. contractors-solutions.net

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: MailChimp

Post by AbleMods » Tue Aug 22, 2017 1:59 pm

What exactly are looking for a Constant Contact integration to do? The CC system has many features, so the complexity (aka time) involved greatly depends on your specific needs.

MailChimp made things pretty easy for a .Net developer to integrate it into an application. CC appears a little more involved. They do offer a .Net wrapper class with examples which is a huge help.

I agree these sorts of integrations should come out-of-the-box to widen the appeal of the Able software.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Tue Aug 22, 2017 2:11 pm

Thanks for your quick response, Joe! I need to do CC because I am hiring a marketing company and they use CC. CC doesn't seem to have all the functionality as MailChimp, so initially, I would like the current Email signup at check out to utilize CC instead of the simple internal list. It would then go through CC's double opt-in routine and have less problems with spam complaints. It is not as good to manually import them and it is nice to have it done automatically from the start. There are many other applications that gather email addresses and integrate with many major email platforms like CC and MailChimp. I can't understand why Able doesn't just do it. It's disappointing and frustrating.
Contractor's Solutions
www. contractors-solutions.net

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: MailChimp

Post by AbleMods » Tue Aug 22, 2017 11:44 pm

I hear your frustration. Effective mail marketing is so key to online sales these days. And there are some great services out there to make it easy to do.

What version of Able Gold are you using?
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Wed Aug 23, 2017 5:16 am

Sorry Joe, I didn't realize you responded. I use to get emails when there was a response. I am using VERSION: 7.0.91.8643
Contractor's Solutions
www. contractors-solutions.net

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: MailChimp

Post by AbleMods » Wed Aug 23, 2017 6:27 am

No problem. Yea sometimes the forum emails don't come through to me either. Too many spam filters in the way these days :)

You're on Gold R11. Give me a day or two so I can take a longer look at the API. Maybe I can get something put together for you.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Wed Aug 23, 2017 10:06 am

I am wondering if I should go through the trouble of upgrading to R12 first. Would there be a problem doing it later, after the email integrtion?
Contractor's Solutions
www. contractors-solutions.net

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: MailChimp

Post by AbleMods » Thu Aug 24, 2017 12:10 am

In order to implement any change to mailing list functionality during checkout, one of the checkout pages will have to be modified. If the upgrade to R12 replaces that page, then yes you'll need to have the any modifications re-applied to the replacement page.

The rest of the code would be separate and not impacted by any upgrade.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Fri Aug 25, 2017 2:43 am

I don't think that will be a problem. When I do upgrade, I know how to merge the old and new pages.
Contractor's Solutions
www. contractors-solutions.net

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Fri Sep 01, 2017 5:21 am

Joe,

Have you gotten the chance to look at that yet?
Contractor's Solutions
www. contractors-solutions.net

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: MailChimp

Post by AbleMods » Sun Sep 03, 2017 2:42 am

I've got the necessary test accounts configured, one for CC itself and the other for the Dev API portal to generate the necessary API security keys.

The demo code provided by CC is a Windows Forms application, not Web Forms or MVC. I've managed to get it to connect to the API endpoint so at least it works from a basic sense. Now I have to make this thing connect via a Web Forms (AbleCommerce) implementation.

One concern I have with their API is it currently throttles the API calls to the rate of 4/sec. Normally not a big deal, except here's the problem: Every request to add a contact requires two calls. The first call must check to see if the contact already exists. The second call can then either Add() or Update() based on the response of the first call.

This means I'm burning up a solid 50% of my available calls with a single add-this-guy-to-a-contact-list action. For an Able store with minimal traffic/checkouts, this might never be an issue. But a busy store could quite quickly slam into that 4/sec limit. I haven't seen how the limit is handled (in the API response) when it has been hit. Or it may be a case of where a dev API limits to 4/sec but a live implementation has a more reasonable call limit. No way to tell until I get further into it.

Overall this API isn't simple, and it's not well documented for the framework used by AbleCommerce. This isn't going to go as smoothly as MailChimp, that much is sure.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Sun Sep 03, 2017 2:59 am

I hate to say this, Maybe it is not worth it?

You say you already did this with MailChimp? The reason I am switching to CC is because I hired an Email Marketer and this is what they use. Maybe there is a work around. How about Zapier?
Contractor's Solutions
www. contractors-solutions.net

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: MailChimp

Post by AbleMods » Sun Sep 03, 2017 9:00 am

Never heard of Zapier, so I can't offer much info there.

I can't really say it's not worth it, more so it's just not going to be a few hours work to make it happen like MailChimp was.

Instagram was worse. I spent 18-20 hours to make that happen and work well. Nothing to do with Able, just due to how Instagram security works. It's similar to CC, so I'm guessing the work to implement would be close to the same.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

kwikstand
Commodore (COMO)
Commodore (COMO)
Posts: 410
Joined: Mon Feb 19, 2007 8:12 pm
Contact:

Re: MailChimp

Post by kwikstand » Sun Sep 03, 2017 2:22 pm

Zapier "Connect Your Apps and Automate Workflows"

https://zapier.com/

They have a ready made "Zap" that adds new MailChimp subscribers to Constant Contact https://zapier.com/app/editor/template/3426
Contractor's Solutions
www. contractors-solutions.net

Post Reply