-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestagent.php
More file actions
92 lines (77 loc) · 2.09 KB
/
testagent.php
File metadata and controls
92 lines (77 loc) · 2.09 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Rocket Agent Test Call</title>
<style>
body {
font-family: system-ui, Arial, sans-serif;
max-width: 480px;
margin: 40px auto;
padding: 20px;
}
label, input, button {
width: 100%;
display: block;
margin-bottom: 12px;
}
input, button {
padding: 10px;
font-size: 16px;
}
button {
cursor: pointer;
}
#status {
margin-top: 10px;
font-size: 14px;
}
</style>
</head>
<body>
<h1>Test the Rocket Agent</h1>
<p>Enter your phone number and our AI receptionist will call you.</p>
<form id="ai-call-form">
<label>Phone number:</label>
<input type="tel" id="phone" placeholder="2045551234 or +12045551234" required>
<button type="submit">Call me</button>
</form>
<div id="status"></div>
<script>
document.getElementById("ai-call-form").addEventListener("submit", async function(e) {
e.preventDefault();
const phone = document.getElementById("phone").value.trim();
const status = document.getElementById("status");
if (!phone) {
status.textContent = "Please enter a phone number.";
return;
}
status.textContent = "Requesting call…";
try {
const res = await fetch("https://rocketagent.onrender.com/call", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ phone })
});
if (res.ok) {
status.textContent = "Your call is being placed!";
} else {
status.textContent = "Something went wrong making the call.";
}
} catch (err) {
console.error(err);
status.textContent = "Network error. Try again.";
}
});
</script>
<!-- Rocket Reception Widget -->
<script
src="https://widget.rocketreception.ca/widget.js"
data-api-base="https://rocketagent.onrender.com"
data-subscriber="rocketsciencedesigns"
></script>
<script>
if (window.RocketChatWidget) RocketChatWidget.init();
</script>
</body>
</html>