You need to save a value that a user gave you as conversation context for re-use later.
Use the Change node to set the take input and store it for re-use later.
[{"id":"e7f9ac15.f89fa8","type":"start","z":"36a987e3.d6314","name":"Start","x":160,"y":240,"wires":[["caca105a.6f2a8"]]},{"id":"caca105a.6f2a8","type":"dialogue","z":"36a987e3.d6314","name":"What is your name?","message":"What is your name?","messageType":"str","displayTimer":1.5,"enableDisplay":false,"x":360,"y":240,"wires":[["280f02b4.516836"]]},{"id":"280f02b4.516836","type":"input","z":"36a987e3.d6314","name":"get name","x":560,"y":240,"wires":[["59d7df2f.898b4"]]},{"id":"59d7df2f.898b4","type":"change","z":"36a987e3.d6314","name":"","rules":[{"t":"set","p":"payload.user.name","pt":"msg","to":"payload.user.message","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":240,"wires":[["abf6cd38.6e3088"]]},{"id":"abf6cd38.6e3088","type":"dialogue","z":"36a987e3.d6314","name":"","message":"Hi there $name!","messageType":"str","displayTimer":1.5,"enableDisplay":false,"x":980,"y":240,"wires":[[]]}]
To try it out simply copy the above json and import it in the flow designer.
Key shortcut Ctrl/⌘-i, Menu option Import
Input messages from users come in as msg.payload.user.message
.
If you double click on the imported Change node, you will see that msg.payload.user.name
is set to whatever msg.payload.user.message
is.
Then when you want to use the variable in dialogue, you can double click on the dialogue node and reference it in your message using $variable
, or in the case of this example, $name
.
Our message and markup nodes support rendering any variable stored as msg.payload.user.variable
using $variable
.
This context is not available outside of this conversation/bot.