-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-webhook-new.html
More file actions
75 lines (70 loc) · 2.95 KB
/
test-webhook-new.html
File metadata and controls
75 lines (70 loc) · 2.95 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<title>Test New Webhook</title>
</head>
<body>
<h1>Test New Webhook with Updated API Key</h1>
<button onclick="testWebhook()">Test Webhook</button>
<div id="result"></div>
<script>
async function testWebhook() {
const result = document.getElementById('result');
result.innerHTML = 'Testing webhook...';
const payload = {
input: {
message: "Hello! Test message with new API key",
chat_id: "test-chat-id"
},
session_variables: {
"x-hasura-user-id": "test-user-id"
}
};
try {
const response = await fetch('https://ankushrajpoot.app.n8n.cloud/webhook/chatbot-free', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
const data = await response.json();
console.log('Webhook response:', data);
if (response.ok) {
result.innerHTML = `
<div style="color: green; border: 1px solid green; padding: 15px; margin: 10px 0;">
<h3>✅ WEBHOOK WORKS!</h3>
<p><strong>Success:</strong> ${data.success}</p>
<p><strong>Message:</strong> ${data.message}</p>
<p><strong>Response:</strong> ${data.response}</p>
<details>
<summary>Full Response</summary>
<pre>${JSON.stringify(data, null, 2)}</pre>
</details>
</div>
`;
} else {
result.innerHTML = `
<div style="color: red; border: 1px solid red; padding: 15px; margin: 10px 0;">
<h3>❌ WEBHOOK FAILED</h3>
<p><strong>Status:</strong> ${response.status}</p>
<p><strong>Error:</strong> ${data.message || JSON.stringify(data)}</p>
<details>
<summary>Full Error Response</summary>
<pre>${JSON.stringify(data, null, 2)}</pre>
</details>
</div>
`;
}
} catch (error) {
result.innerHTML = `
<div style="color: red; border: 1px solid red; padding: 15px; margin: 10px 0;">
<h3>❌ REQUEST FAILED</h3>
<p>${error.message}</p>
</div>
`;
}
}
</script>
</body>
</html>