Skip to content

Commit

Permalink
Merge pull request #179 from SahilFruitwala/fix/beehiiv-api-url-update
Browse files Browse the repository at this point in the history
Updated URL of `beehiiv` API endpoint
  • Loading branch information
timlrx authored Oct 4, 2024
2 parents 2bd7e00 + 0fe6eb3 commit 5cacc65
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/pliny/src/newsletter/beehiiv.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
export const beehiivSubscribe = async (email: string) => {
const API_KEY = process.env.BEEHIIV_API_KEY
const PUBLICATION_ID = process.env.BEEHIIV_PUBLICATION_ID
const API_URL = 'https://api.beehiiv.com/v2'
const API_URL = `https://api.beehiiv.com/v2/publications/${PUBLICATION_ID}/subscriptions`

const data = {
email,
publication_id: PUBLICATION_ID,
reactivate_existing: false,
send_welcome_email: true,
}

const response = await fetch(`${API_URL}/subscribers`, {
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand All @@ -20,4 +19,4 @@ export const beehiivSubscribe = async (email: string) => {
})

return response
}
}

0 comments on commit 5cacc65

Please sign in to comment.