Feb 23, 2015

MailChimp Authentication In Salesforce - Easy Steps (Authentication Part 3)

I hope following post might have helped you in authentication:

So here is the third part of the series, authentication with MailChimp

The whole process of authentication with Mailchimp is divided into some simple steps :

Step 1:- First of all to authenticate with Mailchimp, you must have an account on Mailchimp if not then sign up here.

Step 2:- Now create an app by selecting your name under the logo and select account.

Step 3:- Here as you can see in the given image below, select registered app and register an app here.

Step 4:- Once you've entered the details for your Company and Application and saved them, your client_id and client_secret will be displayed at the bottom of the "edit" page for your application.

Note: - Keep in mind that Redirect Uri is the Uriof your page where you want to be redirected with the "code" parameter.

Step 5:- Now create an apex class and paste the below code in it.

 public string client_id = 'Your ClientId';
 public string client_secret = 'Your ClientSecret';
 public string authorize_uri = 'https://login.mailchimp.com/oauth2/authorize';
 public string redirect_uri = 'https://c.na15.visual.force.com/apex/MailChimpIntegrationPage';
  authorize_uri = authorize_uri + '?response_type=code&client_id=' + client_id + '&redirect_uri=' + Encodingutil.urlEncode(redirect_uri , 'UTF-8');
PageReferencepg = newPageReference(authorize_uri) ;  
returnpg ;
  string code = ApexPages.currentPage().getParameters().get('code') ;  
  HttpRequestreq = newHttpRequest();  
req.setHeader('content-type', 'application/x-www-form-urlencoded'); 
req.setHeader('Accept', 'application/json'); 
        String messageBody = 'grant_type=authorization_code&client_id=' + client_id + '&client_secret=' + client_secret + '&code=' + code + '&redirect_uri=' + Encodingutil.urlEncode(redirect_uri , 'UTF-8');
req.setHeader('Content-length', String.valueOf(messageBody.length()));  

        Http h = newHttp();  
        String resp;  
HttpResponse res = h.send(req);  
resp = res.getBody(); 


Step 6:- Now create a visualforce page and paste the below code in it.


Step 7:- At last create a new remote site setting with value as below

-> Remote Site Name : MailChimp
-> Remote Site URL : https://login.mailchimp.com
-> Active : True

I hope now you can manipulate the code according to the need. As these simple buttons on VFP shows you how to authenticate and get the access tokens.



  1. hi
    I am Soma . I understand that you are excellent in integration. In my application,if i call the same method to connect different web services , will it affect the performance? The number of connection to web service per day may exceed 2000 times and we are using unlimited version.
    Shall i keep separate method to connect each web services? which is the best way to do web service? please advise.

  2. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.

    Python Training in Chennai|Python Classes in Chennai|Python Course in Chennai

  3. Very informative blog and very useful article thank you for sharing with us , keep posting learn more about salesforce training,salesforce online training

  4. This is very helpful post its about latest apps thanks amazing sharing keep sharing..
    selenium training in chennai

  5. Thanks for sharing informative article. Download Windows 7 ultimate for free from getintopc. It helps you to explore full functionality of windows operating system.

  6. The information which you have provided is very good. It is very useful who is looking for salesforce Online course Hyderabad

  7. wihh nice info
    kunjung balik, di web kami banyak penawaran dan tips tentang kesehatan
    Ada artikel menarik tentang obat tradisional yang mampu menyembuhkan penyakit berat, cek yuk
    Obat tradisional Sinusitis
    Obat tradisional Keloid
    Obat tradisional Asam Lambung

  8. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.

    Java training in Chennai | Java training in Annanagar | Java training in Chennai

    Java training in Chennai | Java training in Electronic city

  9. Really you have done great job,There are may person searching about that now they will find enough resources by your post
    online Python training | python training in chennai | Python training course in Chennai

  10. This is ansuperior writing service point that doesn't always sink in within the context of the classroom. In the first superior writing service paragraph you either hook the reader's interest or lose it. Of course your teacher, who's getting paid to teach you how to write an good essay, 
    Data Science course in rajaji nagar | Data Science with Python course in chenni

    Data Science course in electronic city | Data Science course in USA

    Data science course in pune | Data Science Training institute in Pune | Data science course in kalyan nagar | Data Science Course in Bangalore

  11. Thanks for sharing this post. I'm very interested in this topic. https://onlineconvertfree.com/

  12. You have created a nice tutorial
    ethical hacking certification for getting certification on ethical hacking

  13. Thank you for sharing such a nice post!

    Upgrade your career Learn Oracle Training from industry experts gets complete hands on Training, Interview preparation, and Job Assistance at Softgen Infotech.

  14. This comment has been removed by the author.

  15. For a successful Salesforce Integration strategy, it is important to determine the right way to leverage the robust APIs of Salesforce for effectively integrating data and streamlining operations. After that, Salesforce integration helps you get a holistic view of your process, a 360-degree view of your customers, and actionable data.

  16. YES SChool of Language is the Best German Language Institute in Bangalore, india. For More Information You can Visit Website

  17. You have given very good information. Find out more information about best consultancy for germany work visa visit :