gatsby-plugin-mailchimp icon indicating copy to clipboard operation
gatsby-plugin-mailchimp copied to clipboard

Plugin fails if Enable reCAPTCHA is enabled

Open mikelax opened this issue 7 years ago • 5 comments

Overview

If you have a mailing list with the setting for Enable reCAPTCHA turned on, publishing to the list will fail with the error message: captcha.

To get things working I turned off this setting, but it would be nice to have an option for having this feature enabled. I am not exactly sure of the best course of action to get this resolved. At a minimum, the README should be updated to document this issue.

It would be nice to have the option to using this feature within this plugin, if their API supports it then it should be added.

mikelax avatar Jun 23 '18 14:06 mikelax

looking into this.

benjaminhoffman avatar Jul 19 '18 18:07 benjaminhoffman

Thanks for pointing this out @mikelax

I don't know if the Mailchimp API allows it. I can look into this.

In the meantime, got a moment to open a PR updating the README? I can merge this week.

benjaminhoffman avatar Jul 20 '18 03:07 benjaminhoffman

@benjaminhoffman sure will do. do you first want to merge #16 ?

mikelax avatar Jul 20 '18 12:07 mikelax

not sure if there is any way around this. open to suggestions.

benjaminhoffman avatar Aug 20 '18 01:08 benjaminhoffman

I fell into this issue as well. I think I have a work around which could potentially be integrated into the plugin. If I receive "captcha" back as the error, I manually build the URL for the popup window that is triggered in the normal mailchimp embedded form case. I can then open that popup and successfully fulfill the captcha and sign up the user. It's not a great user experience since they need to allow popups but its no worse than using that captcha otherwise. You may be able to load the url in an iframe on the page and allow the user to finish the flow there. The url for the pop up looks like this:

const { result, msg, params } = await addToMailchimp(this.state.email);
if (msg === 'captcha') {
    window.open(`https://<same domain used in plugin config>/subscribe/post?u=${params.u}&id=${params.id}&EMAIL=${encodeURIComponent(params.EMAIL)});
}

I haven't tried it with any of the additional fields that can be passed along as listFields but I expect they could be handled similarly.

EDIT:

I see the url is pretty much exactly the same one as I configured the plugin with. I'm not sure if doing it this way, cancels out some of the point of having the plugin if we know we have the captcha enabled, we could just open that url in a popup on form submit instead of calling addToMailchimp()

fantapop avatar Oct 27 '18 08:10 fantapop