Use DialogFlow

  1. Install the newbot-dialogflow module

npm install newbot-dialogflow

  1. Import the module into the skill and add it to the property skills

import dialogflowSkill from 'newbot-dialogflow'
import code from './main.converse'

export default {
    code,
    skills: {
        dialogflow: dialogflowSkill({
            projectId: 'newagent-1-c9b25',  // https://dialogflow.com/docs/agents#settings,
            sessionId: 'quickstart-session-id',
            languageDefault: 'en-EN', // optionnal
            credentials: 'PATH_TO_JSON_FILE' // https://cloud.google.com/docs/authentication/production
        })
    }
}

Use in ConverseScript

Obtain an answer according to the intention

@Intent('input.welcome')  // action name
welcome() {
    > { :intent.response  } // response
}

Retrieve the entities

@Intent('input.welcome')  // action name
welcome() {
    > Hey { :intent.firstname.value  } // display parameter "firstname"
}

Last updated