mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 02:10:12 -06:00
21 lines
622 B
TypeScript
21 lines
622 B
TypeScript
import { CRON_SECRET, WEBAPP_URL } from "@formbricks/lib/constants";
|
|
import { TPipelineInput } from "@formbricks/types/pipelines";
|
|
|
|
export const sendToPipeline = async ({ event, surveyId, environmentId, response }: TPipelineInput) => {
|
|
return fetch(`${WEBAPP_URL}/api/pipeline`, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"x-api-key": CRON_SECRET,
|
|
},
|
|
body: JSON.stringify({
|
|
environmentId: environmentId,
|
|
surveyId: surveyId,
|
|
event,
|
|
response,
|
|
}),
|
|
}).catch((error) => {
|
|
console.error(`Error sending event to pipeline: ${error}`);
|
|
});
|
|
};
|