$.google()
- Setup
- Login to AdminPanel and go to Token & Keys → Add Variable
- Add Google Clouse Perms Json and save.
$.google.dialogflow.detectIntent(input)
- Is equivalent to projects.agent.sessions.detectIntent
- returns standard google dialogflow detectIntent response
///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?"
}
}