Share feedback, ideas and get community help

Updated 7 months ago

Return string from async function in script logic node

At a glance

A community member is trying to display a string from a script node in a typebot message, but is having trouble. They have tried using the setVariable method, but the variable is not being displayed in the following text bubble node. The community members discuss that the setVariable method may need to be executed on the server, but the community member cannot find the option to do so in their script node. They are using version 2.18.4 and are advised to upgrade to a newer version, which may resolve the issue.

Useful resources
Hi @Baptiste in a script node I have console.log('postAgentMessageToUser content:', content); and i can see the string that exists within 'content' in the console.

I want to display this string back to the user as a typebot message but not sure how to do so. I've tried to set variables within the script node and using a set variable node but haven't gotten anything to work. Any help appreciated
B
o
W
10 comments
setVariable is the way πŸ™‚
if you think there is a bug:
Describe it like this:
  1. Steps to reproduce
  2. What's happening
  3. What were you expecting
Thanks for your answer @Baptiste

I have tried this at the bottom of my script node:


console.log('CONTENT', agent_response); return agent_response; setVariable("Assistant Messages", agent_response);

In console i can see there is a string in the agent_response.

But when i try and display

{{Assistant Messages}} in the following text bubble node it is empty.

I can see in the docs thatthe setVariable will only work when executed on the server but i can't see any settings available for this directly on the script node?
its there on script as well
Attachment
image.png
keep this off to execute on server
Version: 2.18.4
maybe you need to upgrade then
Oh right, please upgrade
Add a reply
Sign up and join the conversation on Discord