VingtCinq / python-mailchimp

Python client for v3 of MailChimp API
MIT License
463 stars 131 forks source link

Cannot assign personalized merge tags to "To: field, such as *|FNAME|* #244

Open tan-yong-sheng opened 2 years ago

tan-yong-sheng commented 2 years ago

First of all, appreciate the works. This library is indeed helpful.

It works when I tried to create an email campaign in Mailchimp, but I have still some problems I have faced

(1) Campaign name cannot be set different from subject line (2) Cannot personalize To Field with merge tags, e.g., |FNAME| (3) Cannot create preview text. (4) can i programmatically upload image to mailchimp server and then get the image link?

image

Below is the function I have used to created to create mailchimp campaign.

def campaign_creation_function(campaign_name, audience_id, from_name, reply_to, client):
    campaign_name = campaign_name
    audience_id = audience_id
    from_name = from_name
    reply_to = reply_to

    data = {
        "recipients" :
        {
            "list_id": audience_id
        },
        "settings":
        {
            "subject_line": campaign_name,
            "from_name": from_name,
            "reply_to": reply_to
        },
        "type": "regular"
    }

    new_campaign = client.campaigns.create(data=data)

    return new_campaign