Skip to content

Commit 5cacc65

Browse files
authored
Merge pull request #179 from SahilFruitwala/fix/beehiiv-api-url-update
Updated URL of `beehiiv` API endpoint
2 parents 2bd7e00 + 0fe6eb3 commit 5cacc65

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
export const beehiivSubscribe = async (email: string) => {
22
const API_KEY = process.env.BEEHIIV_API_KEY
33
const PUBLICATION_ID = process.env.BEEHIIV_PUBLICATION_ID
4-
const API_URL = 'https://api.beehiiv.com/v2'
4+
const API_URL = `https://api.beehiiv.com/v2/publications/${PUBLICATION_ID}/subscriptions`
55

66
const data = {
77
email,
8-
publication_id: PUBLICATION_ID,
98
reactivate_existing: false,
109
send_welcome_email: true,
1110
}
1211

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

2221
return response
23-
}
22+
}

0 commit comments

Comments
 (0)