upstream #1
@ -23,3 +23,7 @@ KLAVIYO_LIST_ID=
|
|||||||
|
|
||||||
REVUE_API_URL=https://www.getrevue.co/api/v2/
|
REVUE_API_URL=https://www.getrevue.co/api/v2/
|
||||||
REVUE_API_KEY=
|
REVUE_API_KEY=
|
||||||
|
|
||||||
|
EMAILOCTOPUS_API_URL=https://emailoctopus.com/api/1.6/
|
||||||
|
EMAILOCTOPUS_API_KEY=
|
||||||
|
EMAILOCTOPUS_LIST_ID=
|
@ -75,7 +75,7 @@ I wanted it to be nearly as feature-rich as popular blogging templates like [bea
|
|||||||
- Blog templates
|
- Blog templates
|
||||||
- TOC component
|
- TOC component
|
||||||
- Support for nested routing of blog posts
|
- Support for nested routing of blog posts
|
||||||
- Newsletter component with support for mailchimp, buttondown, convertkit, klaviyo and revue
|
- Newsletter component with support for mailchimp, buttondown, convertkit, klaviyo, revue, and emailoctopus
|
||||||
- Supports [giscus](https://github.com/laymonage/giscus), [utterances](https://github.com/utterance/utterances) or disqus
|
- Supports [giscus](https://github.com/laymonage/giscus), [utterances](https://github.com/utterance/utterances) or disqus
|
||||||
- Projects page
|
- Projects page
|
||||||
- Preconfigured security headers
|
- Preconfigured security headers
|
||||||
|
@ -60,7 +60,7 @@ I wanted it to be nearly as feature-rich as popular blogging templates like [bea
|
|||||||
- Blog templates
|
- Blog templates
|
||||||
- TOC component
|
- TOC component
|
||||||
- Support for nested routing of blog posts
|
- Support for nested routing of blog posts
|
||||||
- Newsletter component with support for mailchimp, buttondown and convertkit
|
- Newsletter component with support for mailchimp, buttondown, convertkit, klaviyo, revue, and emailoctopus
|
||||||
- Supports [giscus](https://github.com/laymonage/giscus), [utterances](https://github.com/utterance/utterances) or disqus
|
- Supports [giscus](https://github.com/laymonage/giscus), [utterances](https://github.com/utterance/utterances) or disqus
|
||||||
- Projects page
|
- Projects page
|
||||||
- Preconfigured security headers
|
- Preconfigured security headers
|
||||||
|
@ -27,7 +27,7 @@ const siteMetadata = {
|
|||||||
googleAnalyticsId: '', // e.g. UA-000000-2 or G-XXXXXXX
|
googleAnalyticsId: '', // e.g. UA-000000-2 or G-XXXXXXX
|
||||||
},
|
},
|
||||||
newsletter: {
|
newsletter: {
|
||||||
// supports mailchimp, buttondown, convertkit, klaviyo, revue
|
// supports mailchimp, buttondown, convertkit, klaviyo, revue, emailoctopus
|
||||||
// Please add your .env file and modify it according to your selection
|
// Please add your .env file and modify it according to your selection
|
||||||
provider: 'buttondown',
|
provider: 'buttondown',
|
||||||
},
|
},
|
||||||
|
33
pages/api/emailoctopus.js
Normal file
33
pages/api/emailoctopus.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// eslint-disable-next-line import/no-anonymous-default-export
|
||||||
|
export default async (req, res) => {
|
||||||
|
const { email } = req.body
|
||||||
|
if (!email) {
|
||||||
|
return res.status(400).json({ error: 'Email is required' })
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const API_URL = process.env.EMAILOCTOPUS_API_URL
|
||||||
|
const API_KEY = process.env.EMAILOCTOPUS_API_KEY
|
||||||
|
const LIST_ID = process.env.EMAILOCTOPUS_LIST_ID
|
||||||
|
|
||||||
|
const data = { email_address: email, api_key: API_KEY }
|
||||||
|
|
||||||
|
const API_ROUTE = `${API_URL}lists/${LIST_ID}/contacts`
|
||||||
|
|
||||||
|
const response = await fetch(API_ROUTE, {
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response.status >= 400) {
|
||||||
|
return res.status(500).json({ error: `There was an error subscribing to the list.` })
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.status(201).json({ error: '' })
|
||||||
|
} catch (error) {
|
||||||
|
return res.status(500).json({ error: error.message || error.toString() })
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user