Files
formbricks/apps/web/lib/pipelines.ts
Matti Nannt c52df00d39 Fix Email Notifications (#583)
* Fix email notifications not working properly

* Fix response notification not working

* fix response meta schema

* fix typo in docs

* improve error message in webhooks
2023-07-19 12:30:31 +02:00

21 lines
629 B
TypeScript

import { INTERNAL_SECRET, WEBAPP_URL } from "@formbricks/lib/constants";
import { TPipelineInput } from "@formbricks/types/v1/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}`);
});
}