function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael MMichael M 

Einstein Bots- possible to run JS from either apex from a flow?

Hello, I am building an einstein bot, and I want to get the url (window.location.href) of the chatbot in the MIDDLE of the einstein bot dialogue (and therefore extraprechatformdetails won't do the job here.) Einstein bots allow invoking either apex or a flow in the middle of a dialogue. My question is: can I run javascript from a flow or apex class, so that I can get the window.location.href and save it as a variable that I can reference in my bot dialogue?
AbhishekAbhishek (Salesforce Developers) 
https://developer.salesforce.com/docs/atlas.en-us.bot_cookbook.meta/bot_cookbook/bot_cookbook_call_apex_action.htm

https://developer.salesforce.com/docs/atlas.en-us.bot_cookbook.meta/bot_cookbook/bot_cookbook_call_flow_action.htm


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.


Thanks
Michael MMichael M
Hi Abhishek,

Thank you for those links. I am aware of those-- i know that i can invoke apex and flows. My question is specifically on the js piece. Can I get the window.location.href in the MIDDLE of a einsteni bot dialogue?
AbhishekAbhishek (Salesforce Developers) 
https://salesforce.stackexchange.com/questions/326128/how-to-get-window-location-href-as-a-variable-in-einstein-bot

check this
Michael MMichael M
That explains how to get the window.locatoin.href in the beginning of a bot dialogue, as an extraprechatformdetail. However I need to get it in the  MIDDLE, after the bot dialogues have already begun..  That is what I have not found answer to yet.. 
AbhishekAbhishek (Salesforce Developers) 
I have checked internally also Micheal that is the only info I found.
Ravi PRavi P
Did you find the solution for this?