diff --git a/public/support.html b/public/support.html index 37d5424..cced5cc 100644 --- a/public/support.html +++ b/public/support.html @@ -170,12 +170,12 @@ Please note: it does not cover general Odoo usage or functional questions. const uuid = params.get("uuid"); // Generate UUID once per page load - function generateUUID(){ + function generateChatID(){ return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ); } - const CLIENT_UUID = generateUUID(); + const chatId = generateChatID(); function formatTime(date){ return date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); @@ -221,7 +221,7 @@ Please note: it does not cover general Odoo usage or functional questions. if(!text) return; // show user message if(text.toLowerCase().startsWith('/ticket')){ - text = `/ticket ${uuid}`; // Add UUID after /ticket + text = `/ticket UUID:${uuid} chatId: ${chatId}`; // Add UUID after /ticket } appendMessage(text, 'me'); input.value = ''; @@ -240,7 +240,7 @@ Please note: it does not cover general Odoo usage or functional questions. try{ // Post to webhook - expecting a JSON response. Adapt to your backend. - const payload = {text: text, uuid: CLIENT_UUID}; + const payload = {text: text, uuid: uuid, chatid: chatId}; const res = await fetch(WEBHOOK, { method: 'POST', headers: {