Hi Team,
I am trying to build a Personalised Chatbot inside my client portal.
For Now I have embedded an AI chatbot using Chipp.ai and Botpress.com both.
I am able to get an AI chatbot embedded and working just fine. But it just a Well instructed AI Chatbot for the moment.
The next level, I want to go to is
- Pass on the user’s Email and Name to this bot. So that the chats are more personalised.
- Second objective is - I am trying to link my Botpress to my Open AI Assistant API.
If I am able to do the 2 things, I will be able to link the Softr Embed Chatbot to the Open AI assistant which can then have a unique Chat ID for every user with Memory. This way all the chats will be a lot more personal and will have past memory unique to a user
So for this, I will create a unique chat ID in OPEN AI assistant using Make.com for every user whenever they sign up and store all user data in my airtable. Now I want to pass this, User Email ID, User Name and User ChatID to Botpress every time a logged in user initiates a chat.
=====
For the moment, I am not able to figure out how to pass this information whenever a Chat start. This is where I need Softr’s community help.
Things I have already tried -
- Pasted an hidden HTML code in footer to expose user email id and name in a browser session. I used Softr dynamic variable. But this did not work, it only kept giving in Null value or fallback values instead of real user data. I was think if i can expose this information in user browsing session then I can pass this onto Botpress using an OnEvent or something.
But this did not work.
Has anyone figured this out already or can anyone help?
Second Way GPT recommended is to use Make to send this data to Botpress. Need to explore this further but if someone has figure it out that would be great.
Pasting the codes and screenshots below.
Hidden Html code
<div id="softr-user-data"
data-email="<script>document.write(window.softr_user_email)</script>"
data-name="<script>document.write(window.softr_user_full_name)</script>"
style="display: none;">
</div>
Code for Botpress
<div id="softr-user-data" style="display: none;"></div>
<script src="https://cdn.botpress.cloud/webchat/v2.4/inject.js"></script>
<script>
window.addEventListener("DOMContentLoaded", function () {
const userDiv = document.getElementById("softr-user-data");
const email = window.softr_user_email || "guest@admitportal.io";
const name = window.softr_user_full_name || "Guest User";
// Set attributes manually
userDiv.setAttribute("data-email", email);
userDiv.setAttribute("data-name", name);
// Init Botpress
window.botpress.init({
botId: "348d50c9-bf0f-41ed-a1b3-27fb108d3876",
clientId: "c5bb83f3-b308-48eb-9a7f-570280e9ebd6",
useSessionStorage: true,
enableReset: true,
showPoweredBy: false,
hideWidget: false,
onEvent: function () {
const email = userDiv.getAttribute("data-email");
const name = userDiv.getAttribute("data-name");
console.log("Botpress sending:", email, name);
window.botpress.sendEvent({
type: "visit",
payload: {
customUserData: { email, name },
user: { email, name }
}
});
}
});
});
</script>
Console Log screenshot