mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-23 14:08:42 -05:00
f70cda6e11
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
21 lines
626 B
TypeScript
21 lines
626 B
TypeScript
import { INTERNAL_SECRET, WEBAPP_URL } from "@formbricks/lib/constants";
|
|
import { TPipelineInput } from "@formbricks/types/pipelines";
|
|
|
|
export async function sendToPipeline({ event, surveyId, environmentId, response }: TPipelineInput) {
|
|
return fetch(`${WEBAPP_URL}/api/pipeline`, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"x-api-key": INTERNAL_SECRET,
|
|
},
|
|
body: JSON.stringify({
|
|
environmentId: environmentId,
|
|
surveyId: surveyId,
|
|
event,
|
|
response,
|
|
}),
|
|
}).catch((error) => {
|
|
console.error(`Error sending event to pipeline: ${error}`);
|
|
});
|
|
}
|