Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions apps/web/inngest/email/send-welcome-email.ts

This file was deleted.

2 changes: 0 additions & 2 deletions apps/web/pages/api/inngest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { reportUsageForStripeInvoice } from "../../inngest/billing/report-pages-
import { sendConfirmEmailNotification } from "../../inngest/email/send-confirm-email-notification";
import { sendRoadmapTriageNotification } from "../../inngest/email/send-roadmap-triage-notification";
import { sendTeamInviteEmail } from "../../inngest/email/send-team-invite";
import { sendWelcomeEmail } from "../../inngest/email/send-welcome-email";
import { sendVisitorMagicLink } from "../../inngest/email/send-visitor-magic-link";
import { deleteImagesJob } from "../../inngest/jobs/delete-images";
import { processGitHubChangelog } from "../../inngest/jobs/process-github-changelog";
Expand All @@ -18,7 +17,6 @@ export default serve("changes-page", [
sendConfirmEmailNotification,
sendPostNotification,
sendRoadmapTriageNotification,
sendWelcomeEmail,
sendTeamInviteEmail,
sendVisitorMagicLink,
// Background Jobs
Expand Down
32 changes: 2 additions & 30 deletions apps/web/pages/api/users/webhook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NextApiRequest, NextApiResponse } from "next";
import inngestClient from "../../../utils/inngest";

const databaseWebhook = async (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === "POST") {
Expand All @@ -11,35 +10,8 @@ const databaseWebhook = async (req: NextApiRequest, res: NextApiResponse) => {
}

const { type, record, old_record } = req.body;
const user: {
id: string;
email?: string;
raw_user_meta_data?: {
name?: string;
full_name?: string;
};
} = record || old_record;

const { id, email } = user;
console.log("Trigger databaseWebhook [Users]: Record:", type, id);

if (type === "INSERT") {
await inngestClient.send({
name: "email/user.welcome",
data: {
email,
payload: {
first_name:
user.raw_user_meta_data?.full_name ??
user.raw_user_meta_data?.name ??
"there",
},
},
user: {
id,
},
});
}
const user = record || old_record;
console.log("Trigger databaseWebhook [Users]: Record:", type, user.id);

return res.status(200).json({ ok: true });
} catch (err) {
Expand Down