Mailchimp-如何确定用户是否取消订阅? [英] Mailchimp - how can I tell if a user has unsubscribed themselves?

查看:424
本文介绍了Mailchimp-如何确定用户是否取消订阅?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,他们单击了新闻通讯中的取消订阅"链接.在他们的个人资料中,例如:

So they've clicked the unsubscribe link in a newsletter. In their profile it says, for example:

此人于2017年3月24日下午2:40退订

This person unsubscribed on Mar 24, 2017 2:40 pm

收到"Newsletter Test#6"后

After receiving "Newsletter Test#6"

太好了,但是我该如何通过API以编程的方式告知某人是否已取消订阅?可能吗?我要问的原因是因为您无法删除自己取消订阅的人.如果您尝试这样做,其数据将被清除,但电子邮件地址将保留在您的列表中.此外,如果您尝试通过单击取消订阅链接来订阅已取消订阅的人,则会收到"john@example.com由于取消订阅,退回或遵从审核而处于遵从状态,因此无法订阅".因此,在这种情况下,我们应该检查他们是否已退订,如果可以,我们可以将其状态设置为待定",这将发送确认加入电子邮件.否则,我们可以通过API订阅它们,而无需将它们的状态设置为待处理并向他们发送电子邮件,并要求他们单击电子邮件中的链接.

Great, but how can I tell programmatically, via the API, if someone has unsubscribed themselves? Is it even possible? The reason I'm asking is because you can't delete someone who has unsubscribed themselves. If you try, their data will be scrubbed but the email address will stay in your list. Furthermore, if you try to subscribe someone who has unsubscribed by clicking on an unsubscribe link, you'll get "john@example.com is in a compliance state due to unsubscribe, bounce, or compliance review and cannot be subscribed." So in this situation we should check if they've unsubscribed themselves, and if so we can set their status to pending which will send the confirmation opt-in email. Otherwise, we can subscribe them via API without setting their status to pending and sending them an email and requiring them to click the link in the email.

推荐答案

如前所述,如果您尝试删除处于合规状态的某人,则该API将拒绝您的请求,但不幸的是不会返回任何有用的响应,表明因此.另一方面,如果您尝试以合规性状态订阅某人,则应该以json形式获得响应,其中status400并带有相应的消息.就我而言,它看起来像这样:

As you've noted, if you try to delete someone in a compliance state, the API will reject your request but unfortunately doesn't return any useful response indicating as such. On the other hand, if you try to subscribe someone in a compliance state you should get a response in json form with status of 400 and a corresponding message. In my case it looks something like this:

{
    "type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
    "title":"Member In Compliance State",
    "status":400,
    "detail":"johndoe@example.com is in a compliance state due to unsubscribe, bounce, or compliance review and cannot be subscribed.",
    "instance":"1234567890abcdefg"
}

如果仅解析该响应,则可以检查status的值,该值可能比文本描述符更可靠且向前兼容-并且在适用的情况下,可以从此处将成员状态设置为pending.

If you simply parse that response you can check for the value of status which is probably more reliable and forward compatible than the textual descriptors - and if applicable you can set member state to pending from there.

这篇关于Mailchimp-如何确定用户是否取消订阅?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆