Get IP address of the user
Hello guys - is there any way how to get the user's real IP of the physical device, the bot is being executed on ?
We have implemented restrictions in the bot and only thing thats missing is to have unique identifier, thanks to which we could restrict the misbehaving users - we have not yet found a solution, that would fetch the user's real IP address.
There is only VoiceGlow for this so far, from what we have tried, but it fails to load most of the IPs for the first time it seems...
Thank you for any advices !
5 Replies
I dont have access to that thread :/
exotic-emerald•15mo ago
<div style="width: 500px; height: 500px;" id="VG_OVERLAY_CONTAINER">
<!-- Here is where Voiceglow renders the widget. -->
<!-- Set width, height for 500px as an example after changing render to 'full-width' -->
</div>
<!-- Remove 'defer' if you want the widget to load faster (Will affect website loading) -->
<script defer>
(function() {
// 1. Script to Get User IP
function getUserIP() {
return fetch('https://api.ipify.org?format=json')
.then((response) => response.json())
.then((data) => {
console.log("User IP address:", data.ip);
return data.ip;
});
}
// 2. Get User IP and then load Voiceglow
getUserIP().then((userIP) => {
window.VG_CONFIG = {
ID: "yourbotid",
region: 'eu', // 'eu' or 'na' corresponding to Europe and North America
render: 'full-width', // popup or full-width
stylesheets: [
// Base Voiceglow CSS
"https://storage.googleapis.com/voiceglow-cdn/vg_live_build/styles.css",
// Add your custom CSS stylesheets, Can also add a relative URL ('/public/your-file.css)
],
vf_variables: {
userIP: userIP
},
// userID: 'USER_ID', // If you want to use your own user_id
// autostart: true, // Whether to autostart the chatbot with the proactive message
}
var VG_SCRIPT = document.createElement("script");
VG_SCRIPT.src = "https://storage.googleapis.com/voiceglow-cdn/vg_live_build/vg_bundle.js";
document.body.appendChild(VG_SCRIPT);
});
})()
</script>
make "userIP" Variable in voiceflow
this is with voiceglow so make sure to change the botID
Woooow
okay broo
so u dont have to use the 'GetBrowserData' ?
what if it takes some time to load the users IP?
exotic-emerald•15mo ago
bot will be loaded only wehn you get the IP, since the ip is exported before loading the bot
but vpn will bypass it