-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_webhook.js
36 lines (31 loc) · 1010 Bytes
/
get_webhook.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
export const sendTestWebhook = async (userDetails) => {
console.log("User details before sending:", userDetails); // Log the user details before sending
const webhookUrl =
"https://hook.us1.make.com/xkc2perqyggk3s9kl4mgrys8zoibjijq";
const data = {
message: "Request make an appoiment",
timestamp: new Date().toISOString(),
userDetails: userDetails,
};
console.log("Sending test webhook with user details:", data);
try {
const response = await fetch(webhookUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
if (!response.ok) {
throw new Error(`Error: ${response.status}`);
}
const responseBody = await response.text();
console.log(
"Successfully sent test webhook with user details:",
responseBody
);
return "Webhook sent successfully";
} catch (error) {
console.error("Failed to send test webhook with user details:", error);
}
};