Joel Cuff Joel Cuff - 1 year ago 115
ASP.NET (C#) Question

Using MailChimp WebHooks feature

Can someone please provide examples of doing this in ASP.NET. We want to do some MailCHimp – internal database synchronization and plan to do this using webhooks feature but we just can’t get it work. We want to use web hooks to synch data when someone unsubscribes from mail chimp.

Another thing to address is security. How can we secure this page from being accessed by malicious users?

Answer Source

Here is a piece of code that works for us. This is fairly simple but it did take us some experimenting to get it to work.

        if (Request.Form["type"] != null && Request.Form["type"] == "unsubscribe")

            string email = Request.Form["data[merges][EMAIL]"];
           //now you can do insert/update data in your local database

Check out the API documentation for more details

Regarding security you can do a ton of stuff but it depends on how deep you want to go. One thing I’d recommend is checking your IIS logs and finding which IP address/user agent is used by mail chimp to trigger web hooks and then just block this page for all other IP addresses except for this. There are probably other things you can do to additionally secure this like using page name that is not easily guessed (f3jijselife.aspx is far better than webhooks.aspx)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download