File tree 1 file changed +3
-4
lines changed
packages/pliny/src/newsletter
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 1
1
export const beehiivSubscribe = async ( email : string ) => {
2
2
const API_KEY = process . env . BEEHIIV_API_KEY
3
3
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`
5
5
6
6
const data = {
7
7
email,
8
- publication_id : PUBLICATION_ID ,
9
8
reactivate_existing : false ,
10
9
send_welcome_email : true ,
11
10
}
12
11
13
- const response = await fetch ( ` ${ API_URL } /subscribers` , {
12
+ const response = await fetch ( API_URL , {
14
13
method : 'POST' ,
15
14
headers : {
16
15
'Content-Type' : 'application/json' ,
@@ -20,4 +19,4 @@ export const beehiivSubscribe = async (email: string) => {
20
19
} )
21
20
22
21
return response
23
- }
22
+ }
You can’t perform that action at this time.
0 commit comments