Skip to main content Link Search Menu Expand Document (external link)

$.wit()

  • Setup
    1. Login to AdminPanel and go to Token & Keys → Add Variable
    2. Add WIT.ai token and save.

$.wit.message(text)

  • returns standard wit.ai response
///Chained Pattern
async function  onMessageReceive(){
  return $.wit.message(inbound.getText())
              .then(function(resp){
              console.log("resp from with is",resp);
  })

// OR Async
async function  onMessageReceive(){
  let resp = await $.wit.message(inbound.getText())
    console.log("resp from with is",resp);
}

$.wit.intet()

  • returns intent of current inbound message

Sample Code

///Chained Pattern
async function  onMessageReceive(){
  return $.wit()
              .intet()
              .then(function(resp){
              console.log("resp from with is",resp);
  })

// OR Async
async function  onMessageReceive(){
  let resp = await $.wit().intet();
    console.log("resp from with is",resp);
}

Sample response

{ 
  intents : [{ name : "greetings"}],
  entities : [{name : "country",value : "india"}],
  reply : {
      text : "Hi there how can I help you?"
  }
}

Table of contents