-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from lappemic/add-beehiiv
Add beehiiv as newsletter platform
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'pliny': patch | ||
--- | ||
|
||
Added Beehiiv newsletter integration | ||
|
||
- Created new beehiiv.ts file with subscription functionality | ||
- Updated index.ts to include Beehiiv as a newsletter provider option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 data = { | ||
email, | ||
publication_id: PUBLICATION_ID, | ||
reactivate_existing: false, | ||
send_welcome_email: true, | ||
} | ||
|
||
const response = await fetch(`${API_URL}/subscribers`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': `Bearer ${API_KEY}`, | ||
}, | ||
body: JSON.stringify(data), | ||
}) | ||
|
||
return response | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters