Skip to content

Simple API for interacting with API AI

Notifications You must be signed in to change notification settings

ScottZSH/sg-node-api-ai

 
 

Repository files navigation

API AI Node Interface

Travis Code Coverage Version Downloads ISC License

Description

  • Simple API for interacting with API AI
  • Follows the intent naming convention supplied from api.ai and provides method to check if text is of a specific intent.

Installation

npm install node-api-ai --save

Usage

const AIEntity = require('node-api-ai')
const entity = AIEntity({
  dev_key: '<developer access token>',
  client_key: '<client access token>',
  logging: false // optional
})

// IS SINGLE INTENT
entity.initialized
.then(function () {
  return entity.confirmation.isYes('<some text query>') //
})
.then(function (result) {
  result // Boolean
})

// IS MULTIPLE INTENT
entity.findIntent('<some text query>')
.then(function (result) {
  const action = result.action
  return [
    action === entity.confirmation.yes,
    action === entity.confirmation.no
    ...
  ]
})

Dependencies

About

Simple API for interacting with API AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%