从 python mailchimp api 创建活动

creating campaign from python mailchimp api

我正在使用 mailchimp3 python api

from mailchimp3 import MailChimp

client = MailChimp(mc_api='', mc_user='')

client.campaigns.create(data={})

我想创建一个广告系列,但无法理解 'data' 在这种情况下应该是什么。另外,我想在电子邮件中加入 HTML,这样对实现这个的任何帮助都会很棒。提前致谢

活动数据是字典类型。

format reference: line 36:

data = {
    "recipients": object*
    {
        "list_id": string*
    },
    "settings": object*
    {
        "subject_line": string*,
        "from_name": string*,
        "reply_to": string*
    },
    "variate_settings": object* (Required if type is "variate")
    {
        "winner_criteria": string* (Must be one of "opens", "clicks", "total_revenue", or "manual")
    },
    "rss_opts": object* (Required if type is "rss")
    {
        "feed_url": string*,
        "frequency": string* (Must be one of "daily", "weekly", or "monthly")
    },
    "type": string* (Must be one of "regular", "plaintext", "rss", "variate", or "absplit")
}

data 是您发送到 mailchimp 的 api

的 json 负载

请参阅文档以获取有关需要将哪种数据发送到 api

的更多详细信息

参考:- https://mailchimp.com/developer/reference/

例如:-

{ "email_address": "r.siva@alientt.com", "status": "pending" }