top of page
सक्षम
टैलेंट्स
लॉगिन करें
घर
कार्यक्रमों
ब्लॉग
ज्ञान बैंक
हमसे जुड़ें
चर्चाएँ
More
Use tab to navigate through the menu items.
सीखें और बढ़ें
सीखना शुरू करें
सक्षम ब्लॉग
इस भाषा में अभी तक कोई पोस्ट प्रकाशित नहीं हुई
पोस्ट प्रकाशित होने के बाद, आप उन्हें यहाँ देख सकेंगे।
bottom of page
// Function to send chat messages to n8n webhook function sendMessageToN8N(message, userId, chatId) { console.log("Preparing to send message to n8n:", message, userId, chatId); // Debug log fetch("http://localhost:5678/webhook-test/wix-chat", { // REPLACE with your actual public n8n URL method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: message, userId: userId, chatId: chatId }) }) .then(response => response.json()) .then(data => console.log("Message sent successfully to n8n:", data)) .catch(error => console.error("Error sending message to n8n:", error)); } // Ensure Wix Chat is ready before running $w.onReady(() => { console.log("Wix Chat Integration Initialized"); // Debug log $w("#chatbox1").onMessage((message) => { if (message && message.text) { console.log("Received message from Wix Chat:", message.text); // Debug log sendMessageToN8N(message.text, message.senderId, message.chatroomId); } else { console.error("Invalid message format:", message); } }); });