Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 2c0e129

Browse files
committed
Added mailchimp
1 parent 54e6af3 commit 2c0e129

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export STRIPE_SECRET_KEY=$BEAK_STRIPE_SECRET_KEY;
22
export STRIPE_WEBHOOK_SECRET=$BEAK_STRIPE_WEBHOOK_SECRET;
3+
export MAILCHIMP_API_KEY=$BEAK_MAILCHIMP_API_KEY;
34
export AWS_PROFILE=beak

src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ksuid from '@cuvva/ksuid';
2+
import mailchimpMarketing from '@mailchimp/mailchimp_marketing';
23
import type {
34
APIGatewayProxyEventV2,
45
APIGatewayProxyStructuredResultV2,
@@ -54,10 +55,19 @@ function getConfig(): Config {
5455

5556
const stpSecretKey = process.env.STRIPE_SECRET_KEY;
5657
const stpWebhookSecret = process.env.STRIPE_WEBHOOK_SECRET;
58+
const mailchimpApiKey = process.env.MAILCHIMP_API_KEY;
5759

5860
if (!stpSecretKey || !stpWebhookSecret)
5961
throw new Squawk('missing_stripe_config');
6062

63+
if (!mailchimpApiKey)
64+
throw new Squawk('mailchimp_api_key');
65+
66+
mailchimpMarketing.setConfig({
67+
apiKey: mailchimpApiKey,
68+
server: 'us2',
69+
});
70+
6171
return {
6272
env,
6373
jwtPrivateKey,
@@ -68,6 +78,7 @@ function getConfig(): Config {
6878
stpSecretKey,
6979
stpWebhookSecret,
7080
stpSubscriptionPriceId: process.env.STRIPE_SUBSCRIPTION_PRICE_ID ?? 'price_1JhiGIATHKHpwoLyyxI5cCKU',
81+
mailchimpApiKey,
7182
};
7283
}
7384

0 commit comments

Comments
 (0)