write something to user using execute code
# 🤝help
b
in the execute code, what is the line code to write a text to the user ?
f
Are you just trying to send a plain text message to the user?
f
Hi, would be easier to just store the text that you want to send to the user in a workflow variable and then use it in the text card

https://cdn.discordapp.com/attachments/1146540304917332008/1146544479134810343/image.png

something like this
in the code block you can do something like this

https://cdn.discordapp.com/attachments/1146540304917332008/1146544764884373574/image.png

f
Building on what LD just sent another option would be if the value needs to value based on logic execute code then assign the correct value to the variable. Then use the Send message Text option
b
for some reason i don't want to use the send message card there is no command code ? like a print("something")
c
is it because you want to dynamically display some text ?
b
the next node contain an execute code who is use to make an asynch call. the problem is that the card (send a text) don't want to send the message before the request call, so i have a delay, wanted to write something like ( wait a little time )
so it would be simple for me if i make something like print("blablabla") in my asynch call
so my question is precise, can i write something to the user uniquely by using code
and not any card
const endpoint = "" const headers = { Authorization: '', "Content-Type": "application/json" } const data = { "in-0": workflow.question, } try { const response = await axios.post(endpoint, data, { headers }) workflow.apiResponse = response.data["out-0"] } catch (error) { throw new Error('stack-error: $(error)') }
just want to add a line, print ("dsqdsqdsqdsqdsq")
mmmh i dont know if i understand well but yeah
g
Just send "please wait" before this execute code card and then use another send text card to send information after the request is done.
b
Yes that what i did but the "please wait" is sending in the same moment with the another card with send information
It seems like when im using a send text card before the execute code, this card will be showed with a delay, it will wait the request call code finish
By the way when im using with the send text card, an another choice card, its working, my text is showing before the next node, but i dont want the user to choice anything 😭
So i repeat my question, there is any command code to print something to the user ONLY with execute code ? It is possible or not ?
Bp.write("blablabla") Print('blabla')
Something like that
In execute code, is possible ?????
It would be easier in my case to use a thing like that, its rly hard for me to explain why i dont want to use text card
c
no you can't do it directly trough execute command , but you can print out a messag by storing the message inside a variable first. The workflow.apiResponse is something you can print out. If you want a specific error response id make a new variable for that
Copy code
java
const endpoint = ""

const headers = {
    Authorization: '',
    "Content-Type": "application/json"
}

const data = {
    "in-0": workflow.question,
}

  try {
    const response = await axios.post(endpoint, data, { headers })
    workflow.apiResponse = response.data["out-0"]
} catch (error) {
    throw new Error('stack-error: $(error)')
}
workflow.print = "dsqdsqdsqdsqdsq";
inside a text node: @workflow.print
b
The sentence is waiting for the execution of the asynch func

https://cdn.discordapp.com/attachments/1146540304917332008/1146774575124856992/image.png

https://cdn.discordapp.com/attachments/1146540304917332008/1146774575393296404/image.png

i want it to be immediately send to the user aand not waiting
or maybe if its possible to make a loading with 3 point or the spinning wheel during the axios request
Even if i put a variable in my send text card, i have the same problem
Anyone ? 😥
g
@bright-tailor-92965 can you record a quick loom to show what you want and what you have done. Maybe I could help
has you can see, the text "mmmh laissez moi réfléchir" is waiting before to send
i want it to be execute imediately and not waiting for anything
here is the code in the execute code
I hope it's more clear for you and sorry for my bad english
g
how can i display it if it doesnt know what to display,
so it waits to get the information and once it has , it just sends it
b
yes i know, its wait to get the information but I would have liked to send a basic message before this request "mmmh laissez moi réfléchir" means something like "wait a little time"
would like to send a basic message with the card send a text before to go to the next node
but its not working
5 Views