{"id":13683625,"url":"https://github.com/dialogflow/dialogflow-javascript-client","last_synced_at":"2025-04-05T11:10:02.999Z","repository":{"id":33895882,"uuid":"37609579","full_name":"dialogflow/dialogflow-javascript-client","owner":"dialogflow","description":"JavaScript Web SDK for Dialogflow","archived":false,"fork":false,"pushed_at":"2019-02-20T18:55:46.000Z","size":5696,"stargazers_count":413,"open_issues_count":59,"forks_count":174,"subscribers_count":43,"default_branch":"master","last_synced_at":"2024-05-13T06:03:10.281Z","etag":null,"topics":["apiai","javascript","natural-language-processing","nlp","nlu","sdk","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dialogflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-17T17:21:17.000Z","updated_at":"2024-04-12T16:28:23.000Z","dependencies_parsed_at":"2022-08-25T22:41:16.779Z","dependency_job_id":null,"html_url":"https://github.com/dialogflow/dialogflow-javascript-client","commit_stats":null,"previous_names":["api-ai/api-ai-javascript"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialogflow%2Fdialogflow-javascript-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialogflow%2Fdialogflow-javascript-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialogflow%2Fdialogflow-javascript-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialogflow%2Fdialogflow-javascript-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dialogflow","download_url":"https://codeload.github.com/dialogflow/dialogflow-javascript-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apiai","javascript","natural-language-processing","nlp","nlu","sdk","typescript"],"created_at":"2024-08-02T13:02:19.531Z","updated_at":"2025-04-05T11:10:02.963Z","avatar_url":"https://github.com/dialogflow.png","language":"TypeScript","readme":"\n# DEPRECATED\n\n| Deprecated |\n|-------|\n| This Dialogflow client library and Dialogflow API V1 [have been deprecated and will be shut down on October 23th, 2019](https://blog.dialogflow.com/post/migrate-to-dialogflow-api-v2/). Please [migrate to Dialogflow API V2](https://cloud.google.com/dialogflow-enterprise/docs/migrating). |\n\nYou can use this library as common pre-built .js ([choose there](target)).\n\nOr you can install it with nodejs and that import as es6 (or .ts) module. See below. \n\n`npm install api-ai-javascript@2.0.0-beta.14`\n\n\n# Usage\n\n## .textRequest\n\n```javascript\n\nconst client = new ApiAi.ApiAiClient({accessToken: 'YOUR_ACCESS_TOKEN'});\nconst promise = client.textRequest(longTextRequest);\n\npromise\n    .then(handleResponse)\n    .catch(handleError);\n\nfunction handleResponse(serverResponse) {\n        console.log(serverResponse);\n}\nfunction handleError(serverError) {\n        console.log(serverError);\n}\n\n```\n\n## .eventRequest\n\n```javascript\nconst promise = client.eventRequest(\"EVENT_NAME\", options);\n```\n\n# TypeScript and ES6\n\nThis SDK written with Typescript and all it's sources are available in this package. So basically if you are using something like *webpack* or *browserify* with ES6 imports and so on, you can just install this SDK with `$ npm install api-ai-javascript --save-dev` command and then import original sources with something like:\n\n```javascript\n\nimport {ApiAiClient} from \"api-ai-javascript\";\n\nconst client = new ApiAiClient({accessToken: 'YOUR_ACCESS_TOKEN'})\n\n.textRequest('Hello!')\n    .then((response) =\u003e {/* do something */})\n    .catch((error) =\u003e {/* do something here too */})\n\n```\n\n*Note:* If you are going to build es5 version of your bundle with ApiAiClient inside, please add some typings for promises (e.g. @types/es6-promise)\n\nYou also can import and use all defined interfaces and ApiAiConstants:\n\n```javascript\nimport {IRequestOptions, IServerResponse, ApiAiConstants} from \"api-ai-javascript/ApiAiClient\"\nconst lang = ApiAiConstants.AVAILABLE_LANGUAGES.EN;\n```\n\nYou can find full list of interfaces [here](ts/Interfaces.ts)\n\n# Development\n\n* Checkout from this repository, do not forget to switch to \"v2\" branch\n* run `$ npm install`\n* run `$ webpack -w` or just `$ npm start` (as an option for non globally installed dev-server - `$ ./node_modules/.bin/webpack-dev-server`)\n* develop! (webpack will automatically compile SDK to ./target/ApiAi.js file on each change, just include it into some test HTML file (./demo/index.html will probably do the job) and test it).\n\n# Building\n\n`$ npm run-script build` command will build everything\n\n# Testing\n\n`$ npm test`\n\n## Changelog\n\n## 2.0.0-beta.21\n* tts and asr support removed (discontinued on API.AI side)\n## 2.0.0-beta.19\n* minor typings changes\n## 2.0.0-beta.18\n* some minor typings changes\n## 2.0.0-beta.17\n* dependencies updated\n* webrtc typings removed (now part of typescript default lib)\n## 2.0.0-beta.16\n* some linting (ionic2 compatibility issues)\n## 2.0.0-beta.15\n* minor fixes, minor readme updates\n* exported constants\n## 2.0.0-beta.14\n* minor fixes\n* GainNode removed (for now) as non-working in current setup\n## 2.0.0-beta.13\n* IStreamClient is aligned with StreamClient needs, thanks to @muuki88 (#26)\n* Callbacks in IStremClientOptions are now typed properly\n* Added IStreamClient.getGain(): GainNode (#25) to allow set up gain of listener\n* Fixed UTF8 requests, thanks to @elaval (#24)\n## 2.0.0-beta.12\n* Possibility to import ApiAiClient separately from ApiAiStreamClient \n* Typescript project demo setup added \n## 2.0.0-beta.8\n### Breaking changes:\n* Main class renamed from Client to ApiAiClient\n* StreamClient renamed (in exports at least) to ApiAiStreamClient\n* StreamClient class is no longer available inside main ApiAiClient class and now should be passed directly in ApiAiClient constructor: `const client = new ApiAiClient(\"ACCESS_TOKEN\", {streamClientClass: ApiAiStreamClient})`.That was made to allow building your applications without streamclient at all (streamclient now takes about 70% of whole library). And also there will be other implementation of streamClient in the future\n### Non-breaking changes:\n* Demo updated\n\n## How to make contributions?\nPlease read and follow the steps in the [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\nSee [LICENSE](LICENSE).\n\n## Terms\nYour use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/).\n\nThis is not an official Google product.\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdialogflow%2Fdialogflow-javascript-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdialogflow%2Fdialogflow-javascript-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdialogflow%2Fdialogflow-javascript-client/lists"}