MCPcopy Create free account
hub / github.com/code-with-antonio/nodebase / POST

Function POST

src/app/api/webhooks/google-form/route.ts:4–47  ·  view source on GitHub ↗
(request: NextRequest)

Source from the content-addressed store, hash-verified

2import { type NextRequest, NextResponse } from "next/server";
3
4export async function POST(request: NextRequest) {
5 try {
6 const url = new URL(request.url);
7 const workflowId = url.searchParams.get("workflowId");
8
9 if (!workflowId) {
10 return NextResponse.json(
11 { success: false, error: "Missing required query parameter: workflowId" },
12 { status: 400 },
13 );
14 };
15
16 const body = await request.json();
17
18 const formData = {
19 formId: body.formId,
20 formTitle: body.formTitle,
21 responseId: body.responseId,
22 timestamp: body.timestamp,
23 respondentEmail: body.respondentEmail,
24 responses: body.responses,
25 raw: body,
26 };
27
28 // Trigger an Inngest job
29 await sendWorkflowExecution({
30 workflowId,
31 initialData: {
32 googleForm: formData,
33 },
34 });
35
36 return NextResponse.json(
37 { success: true },
38 { status: 200 },
39 );
40 } catch (error) {
41 console.error("Google form webhook error:" , error);
42 return NextResponse.json(
43 { success: false, error: "Failed to process Google Form submission" },
44 { status: 500 },
45 );
46 }
47};

Callers

nothing calls this directly

Calls 1

sendWorkflowExecutionFunction · 0.90

Tested by

no test coverage detected