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

$.google()

  • Setup
    1. Login to AdminPanel and go to Token & Keys → Add Variable
    2. Add Google Clouse Perms Json and save.

$.google.dialogflow.detectIntent(input)

///Chained Pattern
async function  onMessageReceive(){
  return $.google.dialogflow.detectIntent({
      queryInput: {
        text : {
          text: "hello there",
          languageCode: 'en-US'
        }
      }
  }).then(function(resp){
      console.log("resp from with is",resp);
  })
// OR Async
async function  onMessageReceive(){
  let resp = await $.google.dialogflow.detectIntent({
      queryInput: {
        text : {
          text: "hello there",
          languageCode: 'en-US' //opitonal
        }
      }
  });
  console.log("resp from with is",resp);
}

$.google.dialogflow.intent()

  • returns intent of current inbound message

Sample Code

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

// OR Async
async function  onMessageReceive(){
  let resp = await $.google.dialogflow.intent()
  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