What is the msg object?

Flows work by passing messages between nodes. The messages are JavaScript objects that can have any set of properties.

Certain nodes, like the Function node, let you access the properties and values of the msg object just as you would any JavaScript object.

The Debug node displays messages in the Debug sidebar.

Other nodes, like the Say Text, let you output the values of msg object properties within the text. To do this, use mustache tags, similar to what is shown in the following image. The mustache tags to output user information found in the session object, such as {{session.user.firstName}}.

Similarly, you can use mustache tags to output the value of a slot.

{{request.intent.slots.SlotName.value}}

SlotName is the name of a slot defined in an Intent.

Since the msg object is a JavaScript object, and JavaScript is case-sensitive, all variable names, like firstName and lastName are case-sensitive.

 

Related Articles