简体   繁体   English

你能在不使用 API 的情况下获得 MailChimp 兴趣组 ID 吗?

[英]Can you get a MailChimp interest group ID without using the API?

With the MailChimp API, to add a member to a list with a specific interest group, you need both that list's ID and the interest group's ID.使用 MailChimp API,要将成员添加到具有特定兴趣组的列表,您需要该列表的 ID 和兴趣组的 ID。

To get both those IDs, you can either query the API for them, or in the case of the list ID you can find it in the form code that the MailChimp interface outputs.要获得这两个 ID,您可以查询它们的 API,或者在列表 ID 的情况下,您可以在 MailChimp 接口输出的表单代码中找到它。 The interest group ID can not be found in the same way: the form code simply users integer IDs to reference the interest groups, which are not accepted by the API.不能以同样的方式找到兴趣组 ID:表单代码只是使用整数 ID 来引用兴趣组,API 不接受这些 ID。

My question: is there any way to get the interest group IDs other than querying the API first?我的问题:除了先查询 API 之外,还有什么方法可以获取兴趣组 ID? ie somewhere in the MailChimp interface?即在 MailChimp 界面的某个地方?

Context: I'm building a simple add-on to a Wordpress website that includes a MailChimp signup form with interest groups.上下文:我正在为 Wordpress 网站构建一个简单的附加组件,其中包括一个带有兴趣组的 MailChimp 注册表单。 Parameters are set in the website admin including API key and list ID.参数在网站管理中设置,包括 API 密钥和列表 ID。 If possible, I'd like to avoid having to build in a query mechanism to get, list and select the interest groups and rather just have the administrator enter the IDs.如果可能,我想避免必须建立查询机制来获取、列出和选择兴趣组,而只是让管理员输入 ID。

You can use the Playgrounds in the Mailchimp Developer site located at developer.mailchimp.com您可以使用位于developer.mailchimp.com的 Mailchimp 开发人员站点中的 Playgrounds

The Playground is a UI into the API and you can drill down using the Subresources into -> lists -> interest-categories -> interests. Playground 是 API 的 UI,您可以使用子资源向下钻取 -> 列表 -> 兴趣类别 -> 兴趣。

Then choose the Response view and it will show the payload of the response that contains the id's you are looking for.然后选择 Response 视图,它将显示包含您正在寻找的 ID 的响应的负载。

I am using V3 API and you can use Playground to get group id ( Mûhámmàd Yäsår K group name doesn't work for me)我正在使用 V3 API,您可以使用 Playground 获取组 ID( Mûhámmàd Yäsår K组名称对我不起作用)

Playground > List > [Your list] > interest-categories > interests > [Your group]-> You'll see payload with field id Playground > List > [Your list] > Interest-categories > Interest > [Your group]->你会看到带有字段id payload

Now that you have the group id, you can play with creating members: Playground > List > [Your list] > members > Click Create members现在您有了组 ID,您可以开始创建成员了:Playground > List > [Your list] > members > 单击 Create members

Here's the sample payload:这是示例有效负载:

{
    "email_address": "user@mail.com",
    "status": "subscribed",
    "merge_fields": {
        "EMAIL": "user@mail.com",
        "FNAME": "Firstname",
        "LNAME": "Lastname",
        "POST_CODE": "",
        "ADDRESS": "",
        "PHONE": ""
    },
    "interests": {
        "733ba3180d": true
    }
}

Note: interests is not inside merge_fields注意: interests不在merge_fields

Hope this help.希望这有帮助。

据我所知,找到兴趣或兴趣类别 ID 的唯一方法是通过 API 本身。

如上所述,您可以使用 Mailchimp 开发者网站 (developer.mailchimp.com) 中的 Playgrounds,也可以对组的顺序进行排序,以便检索所需的所有 id,而不是依赖 API 调用或仅限于前 10 个.

也可以在嵌入编码表单页面中找到组 ID,但前提是组未隐藏。

What worked for me was using playground: https://us1.api.mailchimp.com/playground/对我有用的是使用游乐场: https : //us1.api.mailchimp.com/playground/

And then to use it, what worked for me was exactly like these:然后使用它,对我有用的就是这些:

$json = json_encode([
    'email_address' => $data['email'],
    'status'        => "subscribed", // "subscribed","unsubscribed","cleaned","pending"
    //'tags'  => array('es'),
    'merge_fields'      => [
        'FNAME'         => $data['name'],
        'USER'          => $data['user'],
        'COUNTRY'       => $data['country'],
        'BIRTHDATE'     => $data['birthdate'],
        'SUBSCRIP'      => $subsription
    ],
    "interests" => array(
        'PLACE_HERE_THE_ID' => true
    )
]);

Hope this helps :)希望这有帮助:)

You can use either interest group id or its name for this(Hope you are using MaiChimp API v3).您可以为此使用兴趣组ID或其名称(希望您使用的是 MaiChimp API v3)。 You can find it the MailChimp interface itself.您可以在 MailChimp 界面本身找到它。

You need to use name instead of id as the parameters.您需要使用name而不是id作为参数。

Please let me know if have any issue with using it.如果使用它有任何问题,请告诉我。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM