https://discord.gg/botpress logo
Custom front end
# šŸ¤help
l
Hello I’m new to botpress Problem: I need a custom frontend I am aware that botpress can be integrated into websites but that limits the customization of the looks of my bot. So I created a webpage with my desired ui and with the help of chat gpt wrote the JavaScript code to handle the sending of data from my webpage to my chatbot using Access token and bot Id. I tested it on local host got an error. Hosted the page with ssl still got an error. So I don’t know what’s wrong šŸ˜‘. Maybe I’m just approaching it all wrong If there are any alternatives or solutions to this I’d love to hear it, thank you This is a snippet from the JavaScript // šŸ”„ Shared function for both voice + text input async function handleUserMessage(userText) { output.innerHTML += `You: ${userText}`; try { // Send to Botpress API const res = await fetch("https://api.botpress.cloud/v1/converse/YOUR_BOT_ID", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY" }, body: JSON.stringify({ user: "demo-user", // Can be dynamic per user/session text: userText }) }); const data = await res.json(); const botReply = data.responses?.[0]?.text || "[No reply]"; output.innerHTML += `Bot: ${botReply}`; // Speak reply const utter = new SpeechSynthesisUtterance(botReply); speechSynthesis.speak(utter); } catch (error) { console.error("Error talking to Botpress:", error); output.innerHTML += `Bot: [Error connecting to Botpress]`; } } https://cdn.discordapp.com/attachments/1410600811389648946/1410600811964403763/DD6EF73E-BDDD-431F-9287-3EF1CF66F9AB.png?ex=68b19be1&is=68b04a61&hm=febb64129d7488484a58702c95cd09e4940e5622f67a164dc58e7b722705b04d&
w
Double check the API everyone, I'm not sure /converse exists
You should more really on the doc than on chatgpt for the endpoints
f
That’s a CORS issue—serve your page from a local server and add that origin/domain in Botpress Allowed Origins. Are you sticking with a custom UI or just testing? @late-monitor-34182
g
I am in a similar situation and found that Converse API has been deprecated, now they are using Chat API. See: https://botpress.com/docs/api-reference/chat-api/introduction I am stuck in the stage of getting the reply from Botpress back into the Custom UI.