I am rebuilding my personal site with Gridsome, a static site builder.
I want to have a (fully) custom email form signup. I currently use EmalOctopus for my email marketing. I leverage their simple API to add subscribers to my list. I understand that using API POST requests (with API key) on the client-side is not safe.
Can anyone think of a solution to this problem? Would really appreciate it.
P.S. The reason I am asking is that I am extremely unhappy with templates on most Email Marketing services.
Try to use plugins for this. For example, I use Gatsby, and my steps are:
Using approach from above, styling a form will take a longer than just making it work.
I use Mailchimp for this same purpose, it will work in a static generator since you are posting to their endpoint.
The way I solve this is I have a small backend that does the actual call to the API. I actually use the same backend to do redirection for multiple newsletters.
That seems like a smart way to do it! Personally I used Netlify and they got a pretty good solution to the forms stuff.
Thanks guys! I am trying to setup a Netlify function to do that. Right now having trouble registering a form with Netlify.
You're right, using an API key on the client-side is not safe. This is because it can be extracted from your site and used by anyone.
I've just added Zapier (zapier.com) integrations to my product Form Flare (formflare.io). Form Flare would act as the back-end for you client-side app. Forms would be submitted to Form Flare then webhooks would kick off any Zapier integrations you had configured (ie. slack notification, append form data to google spreadsheet, add email to Email Octopus...etc).
Form Flare also has some additional nice features like spam filtering, submission archive...etc, which you might be interested in.
#Apologies for shameless plug.
Normally email marketing providers like mail chimp, mailerlite etc. provide the HTML code that you can use for people to subscribe, and that doesn’t require revealing an api key.
Yeah, but they are all so ugly. And they require you add a bunch of scripts to your site. I am trying to avoid this.
That's true. However, sometimes you can get a non-JS version, then from the ugly HTML figure out the necessary elements and use just those.