Send messages to user directly

Use the system function sendToUser() to send a message to the user's chat window, and sendFromUser() to send a message to the chatbot as if the user sent it.

For example:

system.sendToUser("This will go to the user's chat window")

The message: This will go to the user's chat window will appear in the chat window like any other message seen by the user. The message can contain variables. For example, you can add temporary code that will be sent to the Live Preview by using statements such as:

 system.sendToUser("This is my variable" + context.myvariable)

For details of how to use variables, see Using variables in chatbots.

Send internal message to chatbot directly

To send an internal message to the chatbot as if the user sent it, without showing anything in the chat window, you can use system.sendFromUser(). For example:

system.sendFromUser("This will go to the bot as if the user 
sent it")

Debugging

For actions of the Set Variable action type only, you can log messages to the log system for debugging. For example:

log("messages will go to the log");
            log("messages will go to the log", { someobjec: 
"show this" });