Rinze/src/routes/ask-form.js

30 lines
636 B
JavaScript
Raw Normal View History

2021-05-15 07:44:17 +00:00
// Public webhook URL for forms.
let webhookUrl = "https://n8n.nanao.moe/webhook/fd943cbe-fd27-47f8-98ec-01c14b5104fe";
2022-07-24 16:25:35 +00:00
export async function POST({ body }) {
2021-05-15 07:44:17 +00:00
if (!body.message) {
return {
status: 400,
body: {
error: "No message!"
}
}
}
const data = await fetch(webhookUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
message: body.message ?? "Blank form",
}),
})
return {
body: {
success: true,
}
}
}