Store Input as Conversation Context

Problem

You need to save a value that a user gave you as conversation context for re-use later

Solution

Use the Change node to set the take input and store it for re-use later

Example

Save user name

[{"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":[[]]}]

Discussion

Input messages from users come in as msg.payload.user.message.

Our message and markup nodes support rendering any variable stored at msg.payload.user using $variable

In this example we set msg.payload.user.name to whatever msg.payload.user.message is. We then render it using $name in the following message.

This context is not available outside of this conversation/bot.