mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-22 11:29:22 -05:00
fix
This commit is contained in:
@@ -114,9 +114,7 @@ export const AddWebhookModal = ({ environmentId, surveys, open, setOpen }: AddWe
|
||||
}
|
||||
|
||||
const DISCORD_WEBHOOK_URL_PATTERN = /^https:\/\/discord\.com\/api\/webhooks\/\d+\/.+$/;
|
||||
|
||||
const webhookUrl = new URL(testEndpointInput);
|
||||
|
||||
const isDiscordWebhook = DISCORD_WEBHOOK_URL_PATTERN.test(webhookUrl.toString());
|
||||
|
||||
if (isDiscordWebhook) {
|
||||
|
||||
@@ -157,25 +157,11 @@ export const testEndpoint = async (url: string): Promise<boolean> => {
|
||||
);
|
||||
}
|
||||
|
||||
const payload = isDiscordWebhook
|
||||
? {
|
||||
content: "🔔 Test notification from Formbricks",
|
||||
embeds: [
|
||||
{
|
||||
title: "Webhook Test",
|
||||
description: "Ping! This is a test notification from Formbricks.",
|
||||
color: 0x00ff00,
|
||||
},
|
||||
],
|
||||
}
|
||||
: {
|
||||
event: "testEndpoint",
|
||||
message: "Ping! This is a test notification from Formbricks.",
|
||||
};
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload),
|
||||
body: JSON.stringify({
|
||||
event: "testEndpoint",
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user