function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SunilKumar.ax1648SunilKumar.ax1648 

how to save sales force contact in Mail chimp any way to do this

Hi All,

 

I want to save salesforce contact in mailchimp. i am able to save mailchimp object in salesforce but i am not getting any way to save salesforce contact to mailchimp if any body have any idea so plaese share with me. it's very urgent for me

 thanks in advance if any helf form your side. here i am waiting for yuor valuable response.

 

Thanks

Sunil Kumar

Best Answer chosen by Admin (Salesforce Developers) 
SunilKumar.ax1648SunilKumar.ax1648

Hi All,

 

I have done,

 

below is step how to save subscribed salesforce contact to Malchimp.

SalesforceWithMailchimpController

 

1st steps.................

@future (callout=true)
    public static void subScribe(String emailId)
    {
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setbody('{"apikey": "THIS IS MAIL CHIMP API ID come from mail chimp api -us7","id": "THIS IS LIST ID COME FROM MAILCHIMP LIST ","email": {"email": "'+emailId+'","euid": "1","leid": "49"},"merge_vars": {"new-email": "example new-email","groupings": [{"id": 42,"name": "example name","groups": ["..."]}],"optin_ip": "example optin_ip","optin_time": "example optin_time","mc_location": {"latitude": "example latitude","longitude": "example longitude","anything": "example anything"},"mc_language": "example mc_language","mc_notes": [{"note": "example note","id": 42,"action": "example action"}]},"email_type": "example email_type","double_optin": false,"update_existing": true,"replace_interests": true,"send_welcome": false}');
       
        req.setEndpoint('https://us7.api.mailchimp.com/2.0/lists/subscribe.JSON');
        HttpResponse res = h.send(req);
        system.debug(':: Response :: ********'+res.getbody());
    }

2nd step-----

http://apidocs.mailchimp.com/api/2.0/lists/subscribe.php

3rd steps-----

trigger SubscribeTrigger on Contact (after insert) {
for(Contact c : Trigger.new)
{
if(c!=null)
{

SalesforceWithMailchimpController.subScribe(c.email);
SalesforceWithMailchimpController.findAllListByFolderName('xyz');

}
}
}







All Answers

Sonam_SFDCSonam_SFDC

Hi Sunil,

 

With the following app you can sync data between Mailchimp and Salesforce - 

http://kb.mailchimp.com/article/what-is-mailchimp-for-salesforce

 

It is available for download for free, would suggest you to try it:

 https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B3byfEAB

 

Hope this is helpful!

SunilKumar.ax1648SunilKumar.ax1648

Hi All,

 

I have done,

 

below is step how to save subscribed salesforce contact to Malchimp.

SalesforceWithMailchimpController

 

1st steps.................

@future (callout=true)
    public static void subScribe(String emailId)
    {
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setbody('{"apikey": "THIS IS MAIL CHIMP API ID come from mail chimp api -us7","id": "THIS IS LIST ID COME FROM MAILCHIMP LIST ","email": {"email": "'+emailId+'","euid": "1","leid": "49"},"merge_vars": {"new-email": "example new-email","groupings": [{"id": 42,"name": "example name","groups": ["..."]}],"optin_ip": "example optin_ip","optin_time": "example optin_time","mc_location": {"latitude": "example latitude","longitude": "example longitude","anything": "example anything"},"mc_language": "example mc_language","mc_notes": [{"note": "example note","id": 42,"action": "example action"}]},"email_type": "example email_type","double_optin": false,"update_existing": true,"replace_interests": true,"send_welcome": false}');
       
        req.setEndpoint('https://us7.api.mailchimp.com/2.0/lists/subscribe.JSON');
        HttpResponse res = h.send(req);
        system.debug(':: Response :: ********'+res.getbody());
    }

2nd step-----

http://apidocs.mailchimp.com/api/2.0/lists/subscribe.php

3rd steps-----

trigger SubscribeTrigger on Contact (after insert) {
for(Contact c : Trigger.new)
{
if(c!=null)
{

SalesforceWithMailchimpController.subScribe(c.email);
SalesforceWithMailchimpController.findAllListByFolderName('xyz');

}
}
}







This was selected as the best answer
Ken ugiftKen ugift

Is that the only way to do it?  Is there no way of using the Mailchimp Salesforce app to do it?