Remove unused Slack notification code

This commit is contained in:
Adam Moussa 2026-05-11 13:54:24 -04:00
parent d6720061e1
commit eae9655c74

View file

@ -10,7 +10,6 @@
* GOOGLE_ADMIN_EMAIL - Email of a Google Workspace admin to impersonate
* GOOGLE_DOMAIN - Domain to list users for (e.g. seahaven.com)
* GOOGLE_OUS - Comma-separated org unit paths to sync (e.g. /Office/Scheduling,/Office/Operations)
* SLACK_WEBHOOK_URL - (Optional) Slack incoming webhook for sync summaries
*/
const {
@ -191,36 +190,6 @@ async function updateFrontTeammate(frontToken, email, customFields) {
return { status: "error", code: patchRes.status, message: text };
}
// ---------------------------------------------------------------------------
// Slack notification (optional)
// ---------------------------------------------------------------------------
async function notifySlack(webhookUrl, summary) {
if (!webhookUrl) return;
const text = [
`:arrows_counterclockwise: *Front ← Google Directory Sync Complete*`,
`• Updated: ${summary.updated}`,
`• Skipped (not in Front): ${summary.notInFront}`,
`• Skipped (no data): ${summary.noData}`,
`• Errors: ${summary.errors}`,
];
if (summary.errorDetails.length > 0) {
text.push("");
text.push("*Errors:*");
summary.errorDetails.slice(0, 5).forEach((e) => {
text.push(` - \`${e.email}\`: ${e.message}`);
});
}
await fetch(webhookUrl, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: text.join("\n") }),
});
}
// ---------------------------------------------------------------------------
// Handler
// ---------------------------------------------------------------------------
@ -314,9 +283,6 @@ exports.handler = async (event) => {
console.log("Sync summary:", JSON.stringify(summary));
// 5. Notify Slack
await notifySlack(process.env.SLACK_WEBHOOK_URL, summary);
return {
statusCode: 200,
body: summary,