Run function JS on client
Is it possible to use a JS snippet in an Ask Assistant Function block to: a} run the code below on the client or b) execute a block in the flow that currently does this already?
The code:
function parseURL() {
const windowURL = window.location.href;
const allSegments = windowURL.split('/');
const relevantSegments = allSegments.slice(4); // slice starts after third '/'
const modifiedSegments = relevantSegments.map(function(segment) {
return segment.replace(/-/g, ' ');
});
return modifiedSegments;
}
//const splitURL = parseURL();
//const currentURL = JSON.stringify(splitURL);
const currentURL = parseURL();
return currentURL;
Russ Webb•17d ago
The AI Assistant calls the function to get the user's current location on the platform, and asks them to navigate to a new place and checks again to confirm. Just trying to make it happen on the typebot side
Baptiste•16d ago
Unfortunately your code is referencing the
window
variable which only available on the client side. And Tools in AI blocks can't be executed on the client 🙁
Maybe you can collect the currentURL
into a set variable before calling the assistant?Russ Webb•16d ago
Ya, I did that so that gets me close. I was hoping that the Assistant could make a call to "update" the current URL if the user navigates to another part of the platform. For example, the AI asks the user to navigate to the applicable section and now it need to check where they are.
A place to connect with chatbot enthusiasts. Learn about bot building best practices and discover new content.
2KMembers
View on DiscordWant results from more Discord servers?
More PostsAfter reloading the page, the fetchers values come with the value, not the label.I have some fechers, and when I select the value for them and refresh the page it saves the value, aIs possible to change option value in fetcher?Good afternoon, how are you?
I have a funnel dropdown that when selected loads the stages of that fMalicious Typebot linksI have used Typebot on a site amd google found that all typebot links as malicious and shutdown googHow do I use the create workspace api within the typebot flow?API: https://app.typebot.io/api/v1/workspacesAPI GEO LOCATION TO TYPEBOTHello, good evening, I need help integrating ipapi or ipinfo api into typebot so I can see my clientIntegration with Cal.comHi, I am integrating cal.com on my IA assistant running on typebot. I get the return from cal.com buClear chat windowIs there a way, with code or any other means, to clear the chat window of existing messages? When aCreate trigger with zapier to my table app but i have not field that displayhi, i would like to create trigger with zapier to my table app but i have not field that display. Ca