mailchimp-api icon indicating copy to clipboard operation
mailchimp-api copied to clipboard

Add ADDRESS using update_list_member merge fields

Open peterrwilson99 opened this issue 3 years ago • 0 comments

I am updating customers using the Python API. I get a successful response, however the response is still an empty string in the address field.

Python code:

    # mailchimp office address
    address_dict = {
        "addr1": "2015 Main St",
        "addr2": "",
        "city": "Vancouver",
        "state": "BC",
        "country": "Canada",
        "zip": "V5T 3C2",
        }
    merge_fields = {
        'MMERGE7': other_info,
        'MMERGE9': other_info,
        'MMERGE10': other_info,
        'ADDRESS': address_dict,
    }
    try:
        response = client.lists.update_list_member("AUDIENCE_ID", "SUBSCRIBER_HASH", merge_fields)
        print("Succesful Update on", customer['Email'])
        print(response['merge_fields'])

Output of merge fields response

{'FNAME': '', 
'LNAME': '', 
'ADDRESS': '', 
'PHONE': '', 
'MMERGE5': '', 
'MMERGE6': '', 
'MMERGE7': '', 
'MMERGE9': 'CUSTOMER_ID', 
'MMERGE10': 'CUSTOMER NAME', 
'MMERGE11': '', 
'MMERGE12': ''}

Am I doing something wrong here?

peterrwilson99 avatar Sep 18 '21 23:09 peterrwilson99