#4214 - MailChimp Webhooks - how do they work?
Our IP whitelist was blocking webhook traffic from MailChimp (you have to check for this regularly - the webhook IP addresses change frequently).
Accordingly, I've written a tool to re-fire webhooks to SugarChimp. But clearly firing lots of data - that may be obsolete - to SugarChimp could cause problems: people may have re-subscribed to lists they'd unsubscribed from in the meantime, people may have already opted out of a list.
I have the following questions:
- How does SugarChimp look up a SugarCRM contact from the data provided in the webhook?
- How does SugarChimp look up a Target List from the data provided in the webhook?
5 years ago
Additionally, it's really unclear which information is needed for which webhooks.
The MailChimp webhook support contains the following: https://developer.mailchimp.com/documentation/mailchimp/guides/about-webhooks/
"type": "unsubscribe", "fired_at": "2009-03-26 21:40:57",
"data[action]": "unsub", "data[reason]": "manual", "data[id]": "8a25ff1d98", "data[list_id]": "a6b5da1054", "data[email]": "api+unsub@mailchimp.com", "data[email_type]": "html", "data[merges][EMAIL]": "api+unsub@mailchimp.com", "data[merges][FNAME]": "Mailchimp", "data[merges][LNAME]": "API", "data[merges][INTERESTS]": "Group1,Group2", "data[ip_opt]": "10.20.10.30", "data[campaign_id]": "cb398d21d2", "data[reason]": "hard"
But of these fields, which are the ones necessary to process an unsubscribe? E.g., are the merge fields actually used?
5 years ago
Hello John,
These are all great questions. I'm happy to answer them for you:
-We use the email address to match records between the two systems because email addresses on a Mailchimp Audience are unique.
-We add a 'mailchimp_list_name_c' field to the Target List module which is populated with a Mailchimp List id whenever a Target List is synced to a Mailchimp List. We use the list_id from the mailchimp webhook to see if that list is synced to a Sugar a Target List.
It would be safest to send across all of the data from the webhooks, but you can scrub some information based on the type of webhook. For unsubscribes, we only need: -type -fired_at -data[action] -data[reason] -data[list_id] -data[email] (not sure which email we use here so just keep both for safety) -data[merges][EMAIL] -data[campaign_id]
I hope this gives you a clearer picture of what we need. Let me know if you have any more questions on this.
Kind Regards, Jon
5 years ago
Hello there,
We haven't heard from you regarding the issue in a few days. Is there anything we can help with?
Let me know how I can help.
Thanks, Jon Fanatical Labs Support
5 years ago
Thanks for the response fanatical labs!
Yes, please can you tell me the following:
Thanks,
5 years ago
Hello John,
The 'opted out' flag in Sugar actually lives at the email address field, so when a record is marked as opted out in Sugar, it will actually opt out the email address, which makes everyone with that email show as opted out in SugarCRM.
Our default behavior is to mark the record as opted out, which will follow the behavior described. However, we have some different ways of handling Mailchimp unsubscribes using our globaloptout configuration options. If you would like to take a look at those, you can see them here: https://fanaticallabs.zendesk.com/hc/en-us/articles/360021151672-Advanced-Configuration-Settings
Let me know if you have any more questions on that.
Kind Regards, Jon
5 years ago
Hello there,
We haven't heard from you regarding the issue in a few days. Is there anything we can help with?
Let me know how I can help.
Thanks, Jon Fanatical Labs Support