JasperOL commited on
Commit
a637953
·
verified ·
1 Parent(s): 6450309

<!DOCTYPE html>

Browse files

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Agent Activation Station</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
</head>
<body class="bg-gray-50">
<custom-navbar></custom-navbar>
<main class="container mx-auto px-4 pt-2 pb-12 max-w-4xl">
<div class="text-center mb-4">
<p class="text-sm text-gray-600">Choose the agent you want to test</p>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-12">
<!-- Quote Follow Up Agent -->
<div class="agent-card bg-gradient-to-br from-blue-50 to-blue-100"
data-agent="quote"
data-webhook="https://n8n.minimise.co.nz/webhook/d6770799-63da-4787-8b83-983f03b770ea">
<div class="agent-icon bg-blue-100 text-blue-600">
<i data-feather="file-text"></i>
</div>
<h3>Quote Follow Up</h3>
<p>Automatically follow up on sent quotes</p>
<div class="agent-form hidden mt-4">
<input type="tel" class="agent-phone w-full px-3 py-2 border border-gray-300 rounded-lg mb-2" placeholder="Enter phone number">
<button class="agent-activate-btn w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">
Activate Agent
</button>
</div>
</div>

<!-- Invoice Follow Up Agent -->
<div class="agent-card bg-gradient-to-br from-purple-50 to-purple-100"
data-agent="invoice"
data-webhook="https://n8n.minimise.co.nz/webhook/YOUR-INVOICE-WEBHOOK-ID">
<div class="agent-icon bg-purple-100 text-purple-600">
<i data-feather="dollar-sign"></i>
</div>
<h3>Invoice Follow Up</h3>
<p>Gentle reminders for unpaid invoices</p>
<div class="agent-form hidden mt-4">
<input type="tel" class="agent-phone w-full px-3 py-2 border border-gray-300 rounded-lg mb-2" placeholder="Enter phone number">
<button class="agent-activate-btn w-full px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
Activate Agent
</button>
</div>
</div>

<!-- Google Review Agent -->
<div class="agent-card bg-gradient-to-br from-green-50 to-green-100"
data-agent="review"
data-webhook="https://n8n.minimise.co.nz/webhook/YOUR-REVIEW-WEBHOOK-ID">
<div class="agent-icon bg-green-100 text-green-600">
<i data-feather="star"></i>
</div>
<h3>Google Review</h3>
<p>Collect customer reviews automatically</p>
<div class="agent-form hidden mt-4">
<input type="tel" class="agent-phone w-full px-3 py-2 border border-gray-300 rounded-lg mb-2" placeholder="Enter phone number">
<button class="agent-activate-btn w-full px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors">
Activate Agent
</button>
</div>
</div>

<!-- Lead Reactivation Agent -->
<div class="agent-card bg-gradient-to-br from-yellow-50 to-yellow-100"
data-agent="lead"
data-webhook="https://n8n.minimise.co.nz/webhook/YOUR-LEAD-WEBHOOK-ID">
<div class="agent-icon bg-yellow-100 text-yellow-600">
<i data-feather="refresh-cw"></i>
</div>
<h3>Lead Reactivation</h3>
<p>Re-engage cold leads with personalized messages</p>
<div class="agent-form hidden mt-4">
<input type="tel" class="agent-phone w-full px-3 py-2 border border-gray-300 rounded-lg mb-2" placeholder="Enter phone number">
<button class="agent-activate-btn w-full px-4 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700 transition-colors">
Activate Agent
</button>
</div>
</div>

<!-- Conversational Agent -->
<div class="agent-card bg-gradient-to-br from-red-50 to-red-100"
data-agent="conversation"
data-webhook="https://n8n.minimise.co.nz/webhook/YOUR-CONVERSATION-WEBHOOK-ID">
<div class="agent-icon bg-red-100 text-red-600">
<i data-feather="message-square"></i>
</div>
<h3>Conversational</h3>
<p>Natural language customer interactions</p>
<div class="agent-form hidden mt-4">
<input type="tel" class="agent-phone w-full px-3 py-2 border border-gray-300 rounded-lg mb-2" placeholder="Enter phone number">
<button class="agent-activate-btn w-full px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors">
Activate Agent
</button>
</div>
</div>

<!-- Speed to Lead Agent -->
<div class="agent-card bg-gradient-to-br from-indigo-50 to-indigo-100"
data-agent="speed-lead"
data-webhook="https://n8n.minimise.co.nz/webhook/YOUR-SPEED-LEAD-WEBHOOK-ID">
<div class="agent-icon bg-indigo-100 text-indigo-600">
<i data-feather="zap"></i>
</div>
<h3>Speed to Lead</h3>
<p>Instant response to new leads</p>
<div class="agent-form hidden mt-4">
<input type="tel" class="agent-phone w-full px-3 py-2 border border-gray-300 rounded-lg mb-2" placeholder="Enter phone number">
<button class="agent-activate-btn w-full px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors">
Activate Agent
</button>
</div>
</div>
</div>

<div id="confirmation" class="hidden mt-4 mx-auto p-4 bg-blue-50 text-blue-800 rounded-lg max-w-md text-center">
<i data-feather="check-circle" class="inline mr-2"></i>
<span>Agent activated successfully! You'll receive a confirmation shortly.</span>
</div>
</main>

<section class="contact-section">
<div class="container mx-auto px-4 text-center">
<h3 class="text-xl font-semibold">Need help?</h3>
<p>Call us directly and we'll assist you</p>
<a href="tel:+64212833378" class="inline-flex items-center px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors mt-4">
<i data-feather="phone" class="mr-2"></i>
021 283 3378
</a>
</div>
</section>

<custom-footer></custom-footer>

<script>
feather.replace();
</script>

<script>
// Agent Activation Script
document.addEventListener('DOMContentLoaded', function() {
const agentCards = document.querySelectorAll('.agent-card');

agentCards.forEach(card => {
// Toggle form visibility when card is clicked
card.addEventListener('click', function(e) {
// Don't toggle if clicking inside the form
if (!e.target.closest('.agent-form')) {
const form = this.querySelector('.agent-form');
// Close all other forms first
document.querySelectorAll('.agent-form').forEach(f => {
if (f !== form) f.classList.add('hidden');
});
form.classList.toggle('hidden');
}
});

// Handle activation button click
const activateBtn = card.querySelector('.agent-activate-btn');
if (activateBtn) {
activateBtn.addEventListener('click', async function(e) {
e.stopPropagation();

const phoneInput = card.querySelector('.agent-phone');
const phone = phoneInput.value.trim();
const agentType = card.dataset.agent;
const webhookUrl = card.dataset.webhook;

// Validation
if (!phone) {
alert('Please enter a phone number');
return;
}

if (!webhookUrl || webhookUrl.includes('YOUR-')) {
alert('Webhook URL not configured for this agent. Please contact support.');
return;
}

// Disable button during request
activateBtn.disabled = true;
activateBtn.textContent = 'Activating...';

try {
const response = await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
agent: agentType,
phone

Files changed (2) hide show
  1. index.html +2 -2
  2. script.js +82 -80
index.html CHANGED
@@ -21,8 +21,8 @@
21
  <!-- Quote Follow Up Agent -->
22
  <div class="agent-card bg-gradient-to-br from-blue-50 to-blue-100"
23
  data-agent="quote"
24
- data-webhook="data-webhook="https://n8n.minimise.co.nz/webhook/d6770799-63da-4787-8b83-983f03b770ea"">
25
- <div class="agent-icon bg-blue-100 text-blue-600">
26
  <i data-feather="file-text"></i>
27
  </div>
28
  <h3>Quote Follow Up</h3>
 
21
  <!-- Quote Follow Up Agent -->
22
  <div class="agent-card bg-gradient-to-br from-blue-50 to-blue-100"
23
  data-agent="quote"
24
+ data-webhook="https://n8n.minimise.co.nz/webhook/d6770799-63da-4787-8b83-983f03b770ea">
25
+ <div class="agent-icon bg-blue-100 text-blue-600">
26
  <i data-feather="file-text"></i>
27
  </div>
28
  <h3>Quote Follow Up</h3>
script.js CHANGED
@@ -1,89 +1,91 @@
1
 
2
  document.addEventListener('DOMContentLoaded', function() {
 
3
  const confirmation = document.getElementById('confirmation');
4
-
5
- // Agent selection and phone number input
6
- document.querySelectorAll('.agent-card').forEach(card => {
7
- const form = card.querySelector('.agent-form');
8
- const phoneInput = card.querySelector('.agent-phone');
 
 
 
 
 
 
 
 
 
 
 
9
  const activateBtn = card.querySelector('.agent-activate-btn');
10
- // Format phone number input
11
- phoneInput.addEventListener('keydown', function(e) {
12
- // Allow all input except for certain control keys
13
- if ([8, 9, 13, 37, 38, 39, 40].includes(e.keyCode)) {
 
 
 
 
 
 
 
 
14
  return;
15
  }
16
- });
17
- // Toggle form on card click
18
- card.addEventListener('click', function(e) {
19
- // Don't toggle if clicking on form elements
20
- if (e.target === phoneInput || e.target === activateBtn ||
21
- phoneInput.contains(e.target) || activateBtn.contains(e.target)) {
22
- return;
23
- }
24
-
25
- document.querySelectorAll('.agent-card').forEach(c => {
26
- c.classList.remove('selected');
27
- if (c !== card) {
28
- c.querySelector('.agent-form').classList.add('hidden');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
  });
31
-
32
- this.classList.add('selected');
33
- form.classList.toggle('hidden');
34
- });
35
- // Activation button
36
- activateBtn.addEventListener('click', async function(e) {
37
- e.preventDefault();
38
- e.stopPropagation();
39
-
40
- const phoneNumber = phoneInput.value.trim();
41
- if (!phoneNumber) {
42
- alert('Please enter a phone number');
43
- return;
44
- }
45
-
46
- const webhookUrl = card.dataset.webhook;
47
- if (!webhookUrl) {
48
- alert('No webhook configured for this agent');
49
- return;
50
- }
51
-
52
- // Loading state
53
- const originalText = activateBtn.textContent;
54
- activateBtn.textContent = "Sending...";
55
- activateBtn.disabled = true;
56
-
57
- try {
58
- const res = await fetch(webhookUrl, {
59
- method: 'POST',
60
- headers: { 'Content-Type': 'application/json' },
61
- body: JSON.stringify({
62
- phone: phoneNumber,
63
- agent: card.dataset.agent,
64
- source: 'agent-activation-station',
65
- timestamp: new Date().toISOString()
66
- })
67
- });
68
-
69
- if (!res.ok) throw new Error(`Webhook error: ${res.status}`);
70
-
71
- // Success handling
72
- confirmation.classList.remove('hidden');
73
- phoneInput.value = '';
74
- card.classList.remove('selected');
75
- form.classList.add('hidden');
76
-
77
- setTimeout(() => {
78
- confirmation.classList.add('hidden');
79
- }, 5000);
80
- } catch (err) {
81
- console.error(err);
82
- alert('Error sending message to n8n. Check console for details.');
83
- } finally {
84
- activateBtn.textContent = originalText;
85
- activateBtn.disabled = false;
86
- }
87
- });
88
- });
89
  });
 
1
 
2
  document.addEventListener('DOMContentLoaded', function() {
3
+ const agentCards = document.querySelectorAll('.agent-card');
4
  const confirmation = document.getElementById('confirmation');
5
+
6
+ agentCards.forEach(card => {
7
+ // Toggle form visibility when card is clicked
8
+ card.addEventListener('click', function(e) {
9
+ // Don't toggle if clicking inside the form
10
+ if (!e.target.closest('.agent-form')) {
11
+ const form = this.querySelector('.agent-form');
12
+ // Close all other forms first
13
+ document.querySelectorAll('.agent-form').forEach(f => {
14
+ if (f !== form) f.classList.add('hidden');
15
+ });
16
+ form.classList.toggle('hidden');
17
+ }
18
+ });
19
+
20
+ // Handle activation button click
21
  const activateBtn = card.querySelector('.agent-activate-btn');
22
+ if (activateBtn) {
23
+ activateBtn.addEventListener('click', async function(e) {
24
+ e.stopPropagation();
25
+
26
+ const phoneInput = card.querySelector('.agent-phone');
27
+ const phone = phoneInput.value.trim();
28
+ const agentType = card.dataset.agent;
29
+ const webhookUrl = card.dataset.webhook;
30
+
31
+ // Validation
32
+ if (!phone) {
33
+ alert('Please enter a phone number');
34
  return;
35
  }
36
+
37
+ if (!webhookUrl || webhookUrl.includes('YOUR-')) {
38
+ alert('Webhook URL not configured for this agent. Please contact support.');
39
+ return;
40
+ }
41
+
42
+ // Disable button during request
43
+ activateBtn.disabled = true;
44
+ activateBtn.textContent = 'Activating...';
45
+
46
+ try {
47
+ const response = await fetch(webhookUrl, {
48
+ method: 'POST',
49
+ headers: {
50
+ 'Content-Type': 'application/json',
51
+ },
52
+ body: JSON.stringify({
53
+ agent: agentType,
54
+ phone: phone,
55
+ timestamp: new Date().toISOString()
56
+ })
57
+ });
58
+
59
+ if (response.ok) {
60
+ // Show confirmation message
61
+ confirmation.classList.remove('hidden');
62
+
63
+ // Scroll to confirmation
64
+ confirmation.scrollIntoView({ behavior: 'smooth', block: 'center' });
65
+
66
+ // Clear input and hide form
67
+ phoneInput.value = '';
68
+ card.querySelector('.agent-form').classList.add('hidden');
69
+
70
+ // Hide confirmation after 5 seconds
71
+ setTimeout(() => {
72
+ confirmation.classList.add('hidden');
73
+ }, 5000);
74
+ } else {
75
+ alert('Failed to activate agent. Please try again or contact support.');
76
+ }
77
+ } catch (error) {
78
+ console.error('Error:', error);
79
+ alert('Error connecting to service. Please check your connection and try again.');
80
+ } finally {
81
+ // Re-enable button
82
+ activateBtn.disabled = false;
83
+ activateBtn.textContent = 'Activate Agent';
84
  }
85
  });
86
+ }
87
+ });
88
+
89
+ // Initialize feather icons after dynamic content loads
90
+ setTimeout(() => feather.replace(), 100);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  });