mirror of
https://github.com/Sea-Haven-Industries/google-user-sync.git
synced 2026-05-18 20:20:17 +00:00
Remove unused Slack notification code
This commit is contained in:
parent
d6720061e1
commit
eae9655c74
1 changed files with 0 additions and 34 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue