📃
NewBot
  • NewBot, what is it?
  • ConverseScript Syntax
    • Variables
    • Arithmetic
    • Boolean
    • Array and object
    • Entering text and output
    • Magic variables
    • Condition
    • Loop
    • Functions
    • The decorators
      • Use @Condition
      • Use @Action
      • Use @Format
      • Use @Intent
      • Use @Event
  • Prebuilt Formats for Widget
    • Quick Replies
    • Multi Cards
    • Articles
    • Form
  • Pre-built function for the widget
    • Request()
    • Map()
    • _ (lodash)
  • Get Started with Framework
    • Install
    • Main Skill
    • Write the conversational script
  • Use NewBot Framework JS
    • Create a skill (more details)
      • Relationship between skills
      • Use the functions of a child competency
      • Conditional
      • Control access to a skill
    • Create a JavaScript function and trigger it in ConverseScript
    • The constants
    • Write formats
      • Write and use multi-formats
      • Share formats
    • Internationalization (i18n)
    • Set up an NLP system
      • Share the NLP system
      • Use DialogFlow
    • Deploy on the browser
    • Run the chatbot on NodeJS
    • Send data when running the chatbot
    • The middlewares
    • Save the user's progress
    • User object
  • Unit Tests
    • Test a scenario
    • Test variables
    • Spy a function
    • Create a mock
    • Test the events
    • Test the actions
Powered by GitBook
On this page
  • start
  • startAndIntent
  • nothing
  • on
  • canActivate

Was this helpful?

  1. ConverseScript Syntax
  2. The decorators

Use @Event

An event on a function triggers this function according to a situation

start

The start event triggers the function when the user launches the chatbot for the first time. Attention, only the first time!

@Event('start')
nameFunction() {
    > I am ChatBot
}

startAndIntent

The startAndIntent event triggers the function when the user launches the chatbot for the first time and triggers another intent. Attention, only once!

@Event('startAndIntent')
nameFunction() {
    > I am Chatbot. I will try to answer your question
}

nothing

The event nothing triggers the function if no other function is started.

@Event('nothing')
nameFunction() {
    > What ?
}

on

The on event triggers the function according to an outside call:

@Event('on', 'my-event')
nameFunction() {
    > Your name is { :event.name }
}

canActivate

The canActivate event fires to find out if a skill can be performed or not

@Event('canActivate')
auth() {
    > Your password ?
    Prompt()
    if (:text == 'azerty') {
        return true
    }
    return false
}
PreviousUse @IntentNextQuick Replies

Last updated 3 years ago

Was this helpful?