From 83ea0a33f2dee4b9c7ae2ff1f6fdd4fa01e972b6 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Fri, 7 Mar 2025 11:47:45 -0800 Subject: [PATCH] feat: add mastodon --- prod.env | 3 ++- src/index.ts | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/prod.env b/prod.env index 4d449f9..8ffefc8 100644 --- a/prod.env +++ b/prod.env @@ -4,4 +4,5 @@ SLACK_CLIENT_SECRET="op://Environment Variables - Naomi/Mommy/slack_client_secre SLACK_SIGNING_SECRET="op://Environment Variables - Naomi/Mommy/slack_signing_secret" SLACK_CLIENT_ID="op://Environment Variables - Naomi/Mommy/slack_client_id" BSKY_PASSWORD="op://Environment Variables - Naomi/Mommy/bsky_pass" -SLACK_STATE_SECRET="op://Environment Variables - Naomi/Mommy/slack_state_secret" \ No newline at end of file +SLACK_STATE_SECRET="op://Environment Variables - Naomi/Mommy/slack_state_secret" +FEDI_TOKEN="op://Environment Variables - Naomi/Mommy/mastodon_token" \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c0cfca5..99a47bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,7 +73,18 @@ scheduleJob("0 9 * * *", async() => { await bsky.post({ text: response, }); - await logger.log("info", "Posted to bsky.social!"); + await fetch(`https://fedi.nhcarrigan.com/api/notes/create`, { + body: JSON.stringify({ + text: response, + visibility: "public", + }), + headers: { + "Authorization": `Bearer ${process.env.FEDI_TOKEN}`, + "Content-Type": "application/json", + }, + method: "POST", + }); + await logger.log("info", "Posted to bsky and fedi!"); }); serve();