Create a custom Mailchimp subscribe form and send a fetch request to the Mailchimp API

dannyelo
Excursionist
18 1 1

Hello,

I'm developing a custom theme and have an input (email) with a button (subscribe).

I want to know if it's possible to get the email with javascript and use the fetch API to send a request to the Mailchimp API to subscribe a contact.

If this is possible, how can I store the API key so is not accessible to anyone, like an ENV variable or something like that.

I have seen video tutorials where they use this technique but with nodejs, php and other backend tech.

Thanks,

Replies 0 (0)