重新订阅已取消订阅的用户到MailChimp列表

13
我的网站允许用户通过Drupal MailChimp模块使用API订阅MailChimp列表。但是,如果用户通过电子邮件中的链接取消订阅,然后决定通过访问我的网站并选中“订阅”框重新订阅,MailChimp会回复:

xxx@xxx.xxx由于取消订阅、退信或合规审查而处于合规状态,无法进行订阅。

假设用户真的想重新订阅,该怎么办?


2
他们必须采取行动重新订阅。任何手动重新订阅或钓鱼式重新订阅的尝试都超出了Mailchimp协议的条款。基本上,他们必须再次经历整个过程。有用的合规提示 - scoopzilla
4个回答

18

将成员的状态设置为待处理。这样应该会重新发送确认邮件。


1
使用API将用户状态设置为待定会触发MailChimp的确认邮件,用户需要通过点击邮件中的链接进行确认。 在通过API添加或更新用户之前,应首先查询MC API以查看此电子邮件地址是否曾选择退出。如果是,则将其设置为待定并触发MC确认邮件。 如果该电子邮件从未注册过,则将其设置为已订阅,您不会触发确认邮件 - 用户将被注册。 如果该电子邮件当前已选择加入并且尚未取消订阅,则只需更新即可。 - Mike Ferrari
@MikeFerrari - 如果该电子邮件从未注册过,则它们不会处于合规状态。 - But those new buttons though..
将此回滚,因为原始答案很好,并且截至2022年12月仍然有效。我已经使用MC API多年了,据我所知,这种行为从未改变过。 - But those new buttons though..
@EatenbyaGrue - 是的,我们的情况有所不同。 Shopify 插件中存在一个错误,如果用户在结账时没有勾选订阅框,则会从我们的 MailChimp 列表中取消订阅。 用户并没有自己取消订阅,而是由于这个 bug 取消了他们的订阅,我们无法修复我们没有所有权的代码。 - Mike Ferrari

2
如果我们需要重新订阅已取消订阅的电子邮件,
我们需要使用以下选项之一进行put调用:
1. {"status" : "subscribed"}:将重新订阅该电子邮件。
2. {"status" : "pending"}:将发送确认电子邮件以重新订阅。
API端点必须由md5哈希组成,如(/lists/list_id/members/md5hash)。

0

首先从响应中获取状态,如果是取消订阅,则更新列表。这样就可以解决问题啦 ;)

const mailchimp = require("@mailchimp/mailchimp_marketing");
const md5 = require("md5");

router.post("/newsletter-subscribe", asyncWrapper(async (req, res) => {

mailchimp.setConfig({
apiKey: "e4ef******62c481-us17",
server: "us17",
});

const subscriber_hash = md5(email.toLowerCase());
const list_id = '44b****47';
let response = await mailchimp.lists.setListMember(
  list_id,
  subscriber_hash,
  {
    email_address: email,
    status_if_new: 'subscribed',
  }
);
if(response.status=='unsubscribed'){
    response = await mailchimp.lists.updateListMember(
        list_id,
        subscriber_hash,
        {status: 'subscribed'}
      );
}
 return res.json({'subscribed': response.status});


}));

我收到了email@address.com的邮件,由于取消订阅、退信或合规审查而处于合规状态,无法进行订阅。 我发布了一个解决方案,解决了问题。 - frazras

0

一个选择是使用API:首先将其设置为待定,然后将其设置为订阅。将用户设置为待定似乎会发送确认电子邮件,但您可以通过将其设置为已订阅来确保确认。

我在下面包含了一个Python脚本来重新订阅一系列电子邮件。

import hashlib
import requests
import time

# Replace these with your API key and List ID
API_KEY = 'cc2355555555555555555555555555-us1'
LIST_ID = 'c555555555'

# Replace this with your datacenter, e.g. 'us6'
DATACENTER = 'us1'

# List of email addresses to resubscribe
email_addresses = ['email@address.com','email2@address.com']

# Get the total number of email addresses
total_addresses = len(email_addresses)

# Loop through email addresses
for index, email in enumerate(email_addresses):
    # Create md5 hash of the lowercase email address
    email_hash = hashlib.md5(email.lower().encode()).hexdigest()

    # API URL to update the member
    url = f'https://{DATACENTER}.api.mailchimp.com/3.0/lists/{LIST_ID}/members/{email_hash}'

    # Data to update (set status to 'pending' to send opt-in confirmation email)
    data_pending = {
        'status': 'pending',
        'email_address': email
    }

    # Make a PUT request to update the member to pending
    response = requests.put(url, json=data_pending, auth=('anystring', API_KEY))
    
    # Print the response
    print(f'Response for {email} (pending): {response.status_code} - {response.text}')

    # Optional: Wait for a few seconds before updating the status to subscribed
    time.sleep(5)

    # Data to update (set status to 'subscribed')
    data_subscribed = {
        'status': 'subscribed',
        'email_address': email
    }

    # Make a PUT request to update the member to subscribed
    response = requests.put(url, json=data_subscribed, auth=('anystring', API_KEY))

    # Print the response
    print(f'Response for {email} (subscribed): {response.status_code} - {response.text}')

    # Calculate and print the progress percentage
    progress_percentage = (index + 1) / total_addresses * 100
    print(f'Progress: {progress_percentage:.2f}%')

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接