Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Connecting to MailChimp

How can I connect MailChimp to Power BI? Both MailChimp and Power BI have articles about how the two integrate, but I can't find any way to do this. 

 

If I click "Try PowerBI with MailChimp" here, it just brings me to my Power BI web homepage. There's no connector in desktop or web, and there is no app in web. I've spent hours trying to figure this out to no avail...

  • Hi Anonymous  SilacGlasses 

    The first thing you need to do is to create an API key from inside your Mailchimp account.  There are some instructions on how to do this here

    https://mailchimp.com/developer/guides/marketing-api-quick-start/

     

    Once you have that you can use this query to check that everything is set up correctly

     

     

    let
        dc = "us1",
        api_url = "https://" & dc & ".api.mailchimp.com/3.0/ping",
        ClientID = "xxxxxxxx",
        apikey = "xxxxxxxxxxxxxxxxxxxx-us1",
        
        EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & apikey), BinaryEncoding.Base64),
    
        data= Json.Document(Web.Contents(api_url,
       [ 
         Headers = [#"Authorization"=EncodedCredentials]
       ]
       )
       )
    
    in
        data

     

     

     

    Obviously you have to insert your own API key into that query. 

    Two things to note: the value for dc (data center) is particular to each Mailchimp account.  Mine happens to be us1, you need to make sure yours is entered.  You should see the dc value at the end of your API key.  Secondly, the value for ClientID is irrelevant - it can be any string.  MC just uses the API key to authenticate.

    If everything is set up correctly, you should receive a response from Mailchimp that everything is chimpy!

    You can now make authenticated requests to their API.  Exactly how you get what you want is set out in the API documentation here

    https://mailchimp.com/developer/api/marketing/

    https://mailchimp.com/developer/api/transactional/

     

    But for example, if you want to get information on all the lists in your account you can use this query (note that the api_url is different to the first query)

     

     

    let
        dc = "us1",
        api_url = "https://" & dc & ".api.mailchimp.com/3.0/",
        ClientID = "xxxxxxxx",
        apikey = "xxxxxxxxxxxxxxx-us1",
        
        EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & apikey), BinaryEncoding.Base64),
        
        path = "lists/",
    
        data= Json.Document(Web.Contents(api_url,
       [ 
         RelativePath = path,
         Headers = [#"Authorization"=EncodedCredentials]
       ]
       )
       )
    
    in
        data

     

     

     

    This returns a record that can be drilled down into to give information such as this

    Enjoy.

    Phil


    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.

10 Replies

  • Hi Anonymous  SilacGlasses 

    The first thing you need to do is to create an API key from inside your Mailchimp account.  There are some instructions on how to do this here

    https://mailchimp.com/developer/guides/marketing-api-quick-start/

     

    Once you have that you can use this query to check that everything is set up correctly

     

     

    let
        dc = "us1",
        api_url = "https://" & dc & ".api.mailchimp.com/3.0/ping",
        ClientID = "xxxxxxxx",
        apikey = "xxxxxxxxxxxxxxxxxxxx-us1",
        
        EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & apikey), BinaryEncoding.Base64),
    
        data= Json.Document(Web.Contents(api_url,
       [ 
         Headers = [#"Authorization"=EncodedCredentials]
       ]
       )
       )
    
    in
        data

     

     

     

    Obviously you have to insert your own API key into that query. 

    Two things to note: the value for dc (data center) is particular to each Mailchimp account.  Mine happens to be us1, you need to make sure yours is entered.  You should see the dc value at the end of your API key.  Secondly, the value for ClientID is irrelevant - it can be any string.  MC just uses the API key to authenticate.

    If everything is set up correctly, you should receive a response from Mailchimp that everything is chimpy!

    You can now make authenticated requests to their API.  Exactly how you get what you want is set out in the API documentation here

    https://mailchimp.com/developer/api/marketing/

    https://mailchimp.com/developer/api/transactional/

     

    But for example, if you want to get information on all the lists in your account you can use this query (note that the api_url is different to the first query)

     

     

    let
        dc = "us1",
        api_url = "https://" & dc & ".api.mailchimp.com/3.0/",
        ClientID = "xxxxxxxx",
        apikey = "xxxxxxxxxxxxxxx-us1",
        
        EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & apikey), BinaryEncoding.Base64),
        
        path = "lists/",
    
        data= Json.Document(Web.Contents(api_url,
       [ 
         RelativePath = path,
         Headers = [#"Authorization"=EncodedCredentials]
       ]
       )
       )
    
    in
        data

     

     

     

    This returns a record that can be drilled down into to give information such as this

    Enjoy.

    Phil


    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Sir you are a life saver😀 Many many thanks for the excellent post.

    • shobhitverma919's avatar
      shobhitverma919
      New Member

      What Exactly is Client ID? I am very new to API and all. can you please help? 

      Or do we have any other way to connect to power bi and Mailchimp?

       

    • SilacGlasses's avatar
      SilacGlasses
      Frequent Visitor

      Hi Allison, 

      I think that this article is not updated because I can't click on "Mail Chimp for PowerBI" on Microsoft Appsource. That app is not in the shop anymore. 
      Some months ago, I succeeded to make a PowerBI report with MailChimp data thanks to a beta connector directly available on my powerbi desktop. Since the last update of my PWBI desktop, I can't find this connector anymore.
      Is there an other way to connect to my MailChimp data? 

      Thanks a lot  

  • I have my key but I have failed at the 'Make a simple API ping' to check if it is working....where/How do I do this please?

  • Hi Anonymous Since the Mailchimp service pack was deprecated, you would have to look for another way. As a workaround, maybe you can use a 3rd party connector, it can save you a lot of time compared to other options. I've tried windsor.ai, supermetrics and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. In case you wonder, to make the connection first search for the Mailchimp connector in the data sources list:

     

     

    After that, you will have to first create a secret API key in your Mailchimp account and then using your credentials add your account to the platform.

     

     

    Once you’ve done this, you can proceed and go to the “Preview and destination” step

     

     

    There just select the fields you need. Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url.