ng-dialog-flow
v0.0.9
Published
#### Dialogflow is an enterprise-grade NLU platform that makes it easy for developers to design and integrate conversational user interfaces into mobile apps, web applications, devices, and bots.
Downloads
11
Maintainers
Readme
Installation
Dialogflow is an enterprise-grade NLU platform that makes it easy for developers to design and integrate conversational user interfaces into mobile apps, web applications, devices, and bots.
'ng-dialog-flow' an Angular / Ionic library for DialogFlow . Powered by DialogFlow .You will need an Access Token from DialogFlow to access the full function of this machine learning/natural language processing library.
npm install ng-dialog-flow
yarn add ng-dialog-flow
Usage
Import Main Module
import { NgDialogFlowModule,NgDialogFlowService} from 'ng-dialog-flow';
@NgModule({
declarations: [
//....
],
imports: [
//...
NgDialogFlowModule.forRoot({token:'xxxxxxxxxxx'})
],
providers: [NgDialogFlowService],
bootstrap: [AppComponent]
})
Add to service
import { Injectable } from '@angular/core';
import { NgDialogFlowService } from 'ng-dialog-flow';
@Injectable({
providedIn: 'root'
})
export class AppService {
constructor(private service: NgDialogFlowService) { }
ask(mess: string) {
return this.service.askQuestion(mess).subscribe(res=>{
console.log(res);
});
}
}
More
askQuestion
Request parameters:
- message
- timezone
- sessionid
- lang
Response object
export interface Message {
platform: string;
textToSpeech: string;
type: string;
}
export interface Fulfillment {
messages: Message[];
speech: string;
}
export interface Metadata {
intentId: string;
intentName: string;
webhookForSlotFillingUsed: string;
webhookUsed: string;
}
export interface Parameter {
fruit: string[];
}
export interface Result {
action: string;
actionIncomplete: boolean;
contexts: string[];
fulfillment: Fulfillment;
metadata: Metadata;
parameters: Parameter;
resolvedQuery: string;
score: number;
source: string;
}
export interface Statu {
code: number;
errorType: string;
}
export interface RootObject {
id: string;
lang: string;
result: Result;
sessionId: string;
status: Statu;
timestamp: string;
}