-
Notifications
You must be signed in to change notification settings - Fork 40
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 #175 from timlrx/update-newsletter
Update newsletter APIs and contentlayer dependency
- Loading branch information
Showing
11 changed files
with
401 additions
and
127 deletions.
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,5 @@ | ||
--- | ||
'pliny': minor | ||
--- | ||
|
||
remove revue from newsletter list |
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,5 @@ | ||
--- | ||
'pliny': patch | ||
--- | ||
|
||
update pliny to v0.5 |
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,5 @@ | ||
--- | ||
'pliny': patch | ||
--- | ||
|
||
update klaviyo api |
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 |
---|---|---|
|
@@ -46,4 +46,4 @@ | |
] | ||
}, | ||
"packageManager": "[email protected]" | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,20 +1,51 @@ | ||
export const klaviyoSubscribe = async (email: string) => { | ||
const API_KEY = process.env.KLAVIYO_API_KEY | ||
const LIST_ID = process.env.KLAVIYO_LIST_ID | ||
const response = await fetch( | ||
`https://a.klaviyo.com/api/v2/list/${LIST_ID}/subscribe?api_key=${API_KEY}`, | ||
{ | ||
method: 'POST', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
|
||
const data = { | ||
data: { | ||
type: 'profile-subscription-bulk-create-job', | ||
attributes: { | ||
custom_source: 'Marketing Event', | ||
profiles: { | ||
data: [ | ||
{ | ||
type: 'profile', | ||
attributes: { | ||
email: email, | ||
subscriptions: { | ||
email: { | ||
marketing: { | ||
consent: 'SUBSCRIBED', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
// You can add additional params here i.e. SMS, etc. | ||
// https://developers.klaviyo.com/en/reference/subscribe | ||
body: JSON.stringify({ | ||
profiles: [{ email: email }], | ||
}), | ||
} | ||
) | ||
relationships: { | ||
list: { | ||
data: { | ||
type: 'list', | ||
id: LIST_ID, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
const response = await fetch('https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs', { | ||
method: 'POST', | ||
headers: { | ||
Authorization: `Klaviyo-API-Key ${API_KEY}`, | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
revision: '2024-07-15', | ||
}, | ||
body: JSON.stringify(data), | ||
}) | ||
|
||
return response | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.