Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Mailchimp API Post

ryannschuessler
7 - Meteor

Hi! I am wanting to add tags to existing members in Mailchimp through an API. Here is the API Documentation I am referencing: Lists/Audiences > Member Tags | Mailchimp Marketing API Reference | Mailchimp Developer

 

I am running getting a "401 Your request did not include an API key." error when I try the post function in the download tool. Below is my workflow. The input text tool contains the member's email, the formula updates the email to the subscriber hash and the second formula creates the URL, apikey and tags (below is a screenshot of the tag). In the Download tool, URL is the Field and apikey and tags are under payload. If the HTTP Action in the payload is "GET" I am able to view the tags for associated with the member's email. But with the same syntax and action to "POST" I receive the error mentioned above. I think the syntax for tags is incorrect but unsure how to fix. 

ryannschuessler_0-1683038868871.png

ryannschuessler_1-1683038980624.png

 

 

 

6 REPLIES 6
BrandonB
Alteryx
Alteryx

APIs can be very sensitive to case. Can you make sure that in the Payload tab that it is typed "apiKey" with a capital K? 

ryannschuessler
7 - Meteor

Thanks for the response Brandon! When I use the "apiKey" formatting I still get the "401 Your request did not include an API key." error

BrandonB
Alteryx
Alteryx

Ah it looks like it is actually expecting the API key to be base64 encoded rather than passing it directly as a header. 

 

Can you try using a formula tool to create a field called apiKey that has the value "user:YOURAPIKEYHERE". Then follow this with a base64 encode tool which will base64 encode the value you just created. Then follow this with another formula tool that creates a field called Authorization and in your expression put "Basic " + [Base64_encoded]. Then check the box in the headers tab of the download tool to use the Authorization value. 

ryannschuessler
7 - Meteor

Thanks, I added that to my workflow and I'm no longer getting a apikey error. I am still having problems adding a tag to a customer's profile on Mailchimp through an API. In the formula tool I'm adding a new field titled "tags" and selecting it in the payload and changing the HTTP Action to POST. I have tried the following formulas: 'name: "test", status: "active"' and '{ "tags": [{ name: "test", status: "active" }] }' both getting the following error once I pass it through the JSON Parse tool.

ryannschuessler_0-1683898748454.png

 

I'm guessing the tag syntax is incorrect, any ideas on how to fix it?

ryannschuessler
7 - Meteor

I got it to work! I created a column in the formula tool titled tags with '{"tags": [{"name": "test", "status": "active"}]}' as the equation and selected that field under "Take Query String/Body from Field" in the payload tab on the download tool.

 

Thanks for your help @BrandonB !

mkosmicki1
8 - Asteroid

@BrandonB I just used this for my MailChimp API call that started failing this morning. Thanks for the solution!

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels