mailchimp-marketing 插件的deleteListMember 方法中的subscriberHash 参数是什么?

问题描述 投票:0回答:1

当我需要将 laravel 10 应用程序用户添加到 mailchimp 时,我使用 https://github.com/mailchimp/mailchimp-marketing-php (v3.0) 插件

的 addListMember 方法
    $response = $this->getApiClient()->lists->addListMember($this->mailchimpListId, [
        "email_address" => $email,
        "status" => "subscribed",
        'merge_fields' => $userMergeFields,
    ]);
    \Log::info(varDump($response, ' -1 subscribe $response::'));

它返回如下结构:

Array
(
    [id] => 79847477e940c304958adadc24e52312
    [email_address] => [email protected]
    [unique_email_id] => 56ed730de7
    [contact_id] => 7e4dc0052b2bae88c8c914d34e5170d9
    [full_name] => John Doe
    [web_id] => 292542436
    [email_type] => html
    [status] => subscribed
    [consents_to_one_to_one_messaging] => 1
    [sms_phone_number] =>
    [sms_subscription_status] =>
    [sms_subscription_last_updated] =>
    [merge_fields] => stdClass Object

但是当我需要取消订阅用户时,我使用方法deleteListMember,但它有第二个参数subscriber_hash。我尝试传递任何字段的值 上面响应中的 id、unique_email_id、contact_id、web_id 值

但在所有情况下我都收到 404 错误:

The requested resource could not be found

我也搜索了,没有在mailchimp用户属性下找到像subscriber_hash这样的参数:

在网上搜索我发现一些提示可以使用mailchimp的subscriberHash方法 - 但我在库中没有通过包提供任何类似的功能。

我怎样才能得到这个subscriberHash值?

laravel mailchimp
1个回答
0
投票

您可以在这里查看他们的文档:https://mailchimp.com/developer/marketing/docs/methods-parameters/#path-parameters

subscriber_hash
是客户的电子邮件,小写并经过 MD5 哈希处理。

因此,在您的 Laravel 项目中,您可以通过执行以下操作来创建哈希:

md5(strtolower($email));
© www.soinside.com 2019 - 2024. All rights reserved.