Send data when running the chatbot
Sometimes you have to send data to find out where the user is coming from or other information.
The third parameter is an object. It contains the data
property that can have any type of data.
Retrieve data
You can find the data in the functions of the skill, the writing of formats, the decorator @Condition, etc. For example, when you write a function, you have the data
property:
In the case of a format, data
is a parameter:
Required for the newbot-formats module
When you run a skill using the newbot-formats
module, you must execute the skill by sending asession
object:
These data indicate the source and the agent. This will know where the user comes from and send him the answer on the right platform.
To simplify and standardize the writing of the
session
object, thenewbot-formats
package containsSession
type objects already developed by platform and agent (ex:newbot-formats/session/bottender
) . See chapterUse with Bottender
In unit tests
The unit test can also send data:
The first parameter of the createUser
method contains the object corresponding todata
Last updated