mirror of
https://github.com/Dokploy/website.git
synced 2026-07-16 19:35:27 +02:00
feat: integrate Slack notifications for contact form submissions
- Added a new Slack notification feature to alert sales or support channels upon contact form submissions. - Implemented a `notifySlack` function to format and send messages to Slack using a webhook. - Enhanced error handling to ensure email notifications proceed even if Slack notifications fail.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getHubSpotUTK, submitToHubSpot } from "@/lib/hubspot";
|
||||
import { notifySlack } from "@/lib/slack";
|
||||
import type { NextRequest } from "next/server";
|
||||
import { NextResponse } from "next/server";
|
||||
import { Resend } from "resend";
|
||||
@@ -70,6 +71,23 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
// Send notification to Slack (sales or support channel)
|
||||
try {
|
||||
const slackSuccess = await notifySlack(body);
|
||||
if (slackSuccess) {
|
||||
console.log(
|
||||
`Successfully sent ${body.inquiryType} inquiry notification to Slack`,
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
`Failed to send ${body.inquiryType} inquiry notification to Slack, but continuing with email`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error sending to Slack:", error);
|
||||
// Continue with email even if Slack fails
|
||||
}
|
||||
|
||||
// Format email content
|
||||
const emailSubject = `[${body.inquiryType.toUpperCase()}] New contact form submission from ${body.firstName} ${body.lastName}`;
|
||||
const emailBody = `
|
||||
|
||||
Reference in New Issue
Block a user