{"id":15387892,"url":"https://github.com/mishushakov/dialogflow-gateway-js","last_synced_at":"2025-04-15T19:54:40.211Z","repository":{"id":34695824,"uuid":"182063805","full_name":"mishushakov/dialogflow-gateway-js","owner":"mishushakov","description":"🔌 Dialogflow V2 JS SDK for node and browser","archived":false,"fork":false,"pushed_at":"2023-03-14T16:49:21.000Z","size":528,"stargazers_count":6,"open_issues_count":6,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T19:54:37.022Z","etag":null,"topics":["client","dialogflow","dialogflow-v2","nlu"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/dialogflow-gateway","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mishushakov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-18T10:02:43.000Z","updated_at":"2024-08-30T09:15:55.000Z","dependencies_parsed_at":"2024-10-18T19:02:40.988Z","dependency_job_id":"f8409208-f96c-4035-bef8-fe7a796918a5","html_url":"https://github.com/mishushakov/dialogflow-gateway-js","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.15625,"last_synced_commit":"f401c7a4fc6ba59c0002a31fd7c5d09e75117f4f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishushakov%2Fdialogflow-gateway-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishushakov%2Fdialogflow-gateway-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishushakov%2Fdialogflow-gateway-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishushakov%2Fdialogflow-gateway-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mishushakov","download_url":"https://codeload.github.com/mishushakov/dialogflow-gateway-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249145296,"owners_count":21219966,"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":["client","dialogflow","dialogflow-v2","nlu"],"created_at":"2024-10-01T14:54:54.198Z","updated_at":"2025-04-15T19:54:40.186Z","avatar_url":"https://github.com/mishushakov.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dialogflow Gateway JavaScript SDK\n\nDialogflow Gateway enables third-party integrations to securely access the Dialogflow V2 API\n\n- [Documentation](https://github.com/mishushakov/dialogflow-gateway-docs)\n- [Implementations](https://github.com/mishushakov/dialogflow-gateway-docs#implementations)\n\nThis is a JavaScript Client, that is compatitable with Dialogflow Gateway backends.\nIt can be used both in browser and node as a drop-in replacement for the deprecated `dialogflow-javascript-client` library, by Dialogflow\n\n**Attention: v1.0 is no longer using promises to retrieve messages and relies on events instead**\n\n## Installation\n\nnpm:\n\n`npm install dialogflow-gateway`\n\nyarn:\n\n`yarn add dialogflow-gateway`\n\nBrowser:\n\n```html\n\u003cscript src=\"https://unpkg.com/dialogflow-gateway@latest/dist/bundle.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nImport the library and connect to your Dialogflow Gateway Endpoint:\n\n```js\nimport { Client } from 'dialogflow-gateway'\n\nnew Client('\u003cYOUR ENDPOINT HERE\u003e')\n```\n\nNote: Endpoint is a URL (example: https://dialogflow-web-v2.core.ushaflow.io)\n\n## Events\n\n- `error`, returns error\n- `message`, returns the message body\n\n## Examples\n\nWith Async/Await and ES Modules on [Dialogflow Gateway Hosted by Ushakov](https://dialogflow.cloud.ushakov.co)\n\n```js\nimport { Client } from 'dialogflow-gateway'\n\nasync () =\u003e {\n  /* Connect Dialogflow Gateway Client */\n  const client = new Client('https://dialogflow-web-v2.core.ushaflow.io')\n\n  /* Send text request */\n  await client.send({\n    session: 'test',\n    queryInput: {\n      text: {\n        text: 'Hello',\n        languageCode: 'en'\n      }\n    }\n  })\n\n  client.on('message', console.log)\n  client.error('message', console.error)\n\n  /* Retrieve the Agent */\n  try {\n    const agent = await client.get())\n    console.log(agent)\n  }\n\n  catch (error){\n    // Handle error\n  }\n}\n```\n\nSame code with require and promises\n\n```js\nconst { Client } = require('dialogflow-gateway')\n\n/* Connect Dialogflow Gateway Client */\nconst client = new Client('https://dialogflow-web-v2.core.ushaflow.io')\n\n/* Send text request */\nclient.send({\n  session: 'test',\n  queryInput: {\n    text: {\n      text: 'Hello',\n      languageCode: 'en'\n    }\n  }\n})\n\nclient.on('message', console.log)\nclient.error('message', console.error)\n\n/* Retrieve the Agent */\nclient.get()\n.then(agent =\u003e {\n  console.log(agent)\n})\n.catch(error =\u003e {\n  // Handle Error\n})\n```\n\nSame code in Browser. Notice, that we are using the `df` scope\n\n```js\n/* Connect Dialogflow Gateway Client */\nconst client = new df.Client('https://dialogflow-web-v2.core.ushaflow.io')\n\n/* Send text request */\nclient.send({\n  session: 'test',\n  queryInput: {\n    text: {\n      text: 'Hello',\n      languageCode: 'en'\n    }\n  }\n})\n\nclient.on('message', console.log)\nclient.error('message', console.error)\n\n/* Retrieve the Agent */\nclient.get()\n.then(agent =\u003e {\n  console.log(agent)\n})\n.catch(error =\u003e {\n  // Handle Error\n})\n```\n\nFor more examples see [examples directory](./examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmishushakov%2Fdialogflow-gateway-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmishushakov%2Fdialogflow-gateway-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmishushakov%2Fdialogflow-gateway-js/lists"}