From 7a854782b07a42f3cbb61a3964a33f85f7ba68cd Mon Sep 17 00:00:00 2001 From: MarconLP <13001502+MarconLP@users.noreply.github.com> Date: Sat, 13 May 2023 19:40:50 +0200 Subject: [PATCH] add 'event trigger' event --- apps/nextjs/src/pages/api/v1/log.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/nextjs/src/pages/api/v1/log.ts b/apps/nextjs/src/pages/api/v1/log.ts index cff7d5a..aae044b 100644 --- a/apps/nextjs/src/pages/api/v1/log.ts +++ b/apps/nextjs/src/pages/api/v1/log.ts @@ -1,6 +1,7 @@ import type { NextApiRequest, NextApiResponse } from "next"; import { z } from "zod"; +import { posthog } from "@acme/api/posthog"; import { prisma } from "@acme/db"; import admin from "~/utils/firebaseAdmin"; @@ -139,5 +140,19 @@ export default async function handler( } } + posthog?.capture({ + distinctId: userId, + event: "trigger event", + properties: { + notify, + event, + description, + icon, + projectId: projectDoc[0].id, + channelId: channelDoc[0].id, + }, + }); + void posthog?.shutdownAsync(); + res.send(notification); }