If an App contains the main Intent, it will be executed as soon as a user opens a conversation.

The main Intent is not mandatory. If it is not present, the system will not trigger any errors.

Usually, main is used for user greetings and for initialising the State loading data from the database.

main adds one event, called onInit, that is executed as the first step. The onInit closure is not mandatory. This Intent skips the Intent Matching and the Intent Validation process, so if developers add code to these methods, the framework will ignore it.

Here is an example of a main method implementation that greets users saying "Hello world!":

  //Intent Main
  let main = new Intent("main");
  main.onInit = () => {
    //State initialisation
  main.onResolution = async () => {
    state.addStringResponse("Hello World!");

This is the execution flow of the main Intent:




Please sign in to leave a comment.