{"id":13598354,"url":"https://github.com/adrien2p/nestjs-api-ai","last_synced_at":"2025-10-02T14:31:58.400Z","repository":{"id":113647777,"uuid":"100620581","full_name":"adrien2p/nestjs-api-ai","owner":"adrien2p","description":"Nest + Api.ai","archived":true,"fork":false,"pushed_at":"2018-05-08T17:11:03.000Z","size":536,"stargazers_count":24,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-04T07:01:11.165Z","etag":null,"topics":["actionsongoogle","ai","api-ai","assistant","dotenv","jsonwebtoken","jwt","nest","nest-js","node","nodejs","orm","sequelize","typescript"],"latest_commit_sha":null,"homepage":"","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/adrien2p.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}},"created_at":"2017-08-17T15:49:32.000Z","updated_at":"2024-08-04T07:01:11.166Z","dependencies_parsed_at":null,"dependency_job_id":"a312f9ce-7955-4b8c-ac61-06fdd33c3176","html_url":"https://github.com/adrien2p/nestjs-api-ai","commit_stats":null,"previous_names":["adrien2p/nest-js-api-ai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-api-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-api-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-api-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrien2p%2Fnestjs-api-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrien2p","download_url":"https://codeload.github.com/adrien2p/nestjs-api-ai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219875712,"owners_count":16554705,"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":["actionsongoogle","ai","api-ai","assistant","dotenv","jsonwebtoken","jwt","nest","nest-js","node","nodejs","orm","sequelize","typescript"],"created_at":"2024-08-01T17:00:51.943Z","updated_at":"2025-10-02T14:31:58.061Z","avatar_url":"https://github.com/adrien2p.png","language":"TypeScript","readme":"### [UNMAINTAINED] use [nestjs-dialogflow](https://github.com/adrien2p/nestjs-dialogflow) instead\n\n![Nest](assets/logo.png)\n\nThis project allow you to catch web hook from [api.ai](https://api.ai/) when a request is triggered \non you agent, the server process the result to send back the response and let your assistant speech it.\n\nFor the authentication part, when the user is authenticated with google OAuth2, The middleware catch the request\nto create the user locally if is not already created.\n\n ### How it works\n \n- To run lint and fix `npm run lint`\n- To run tests suite `npm run test`\n- Start the server `npm start`\n- To run up/down migration `npm run migrate {up/down}`\n\n### Configuration\n\nTo configure put all config file in the `./src/config/*`.\nTo use the env variable, remove `.demo` from `.env.demo`.\n\n### WebHook from [api.ai](https://api.ai/)\n\nTo receive a callback from [api.ai](https://api.ai/), you must enabled webhook in `Fullfillment` tab and fill all information needed.\nTo see how it works locally, you need to activate a local tunnel using the following url\n \n- `GET http://localhost:3000/localTunnelStart` to start it\n- `GET http://localhost:3000/localTunnelStop` to close it\n\nThe local tunnel url returned need to be write in the `url` section with the path to the webHook which is actually `/apiAi`\n\nAfter to be logged in your app you should give you `token` access in the `headers` section : `authorization ...`\nThen, active `Fullfillment` in the targeted intent.\n\n![fullfillment](assets/fulfillment.png)\n\nAfter that, to connect your agent to actions on google, go to `Integration` part and active actions on google.\nThen configure it to access `OAuth2` authentication with google. (Look `google cloud platform` to manage you OAuth settings).\n\nAfter [api.ai](https://api.ai/) received request, you should received a callback as the following result :\n```json\n{\n    \"source\": \"agent\",\n    \"resolvedQuery\": \"quelle est la météo\",\n    \"action\": \"weather\",\n    \"actionIncomplete\": true,\n    \"parameters\": {\n      \"address\": \"\",\n      \"date-time\": \"\"\n    },\n    \"contexts\": [\n        {\n            \"name\": \"weather_dialog_context\",\n            \"parameters\": {\n                \"date-time.original\": \"\",\n                \"address\": \"\",\n                \"date-time\": \"\",\n                \"address.original\": \"\"\n            },\n                \"lifespan\": 2\n            },\n            {\n            \"name\": \"db44589c-29e2-447c-8368-94503e3ccae9_id_dialog_context\",\n            \"parameters\": {\n                \"date-time.original\": \"\",\n                \"address\": \"\",\n                \"date-time\": \"\",\n                \"address.original\": \"\"__\n            },\n            \"lifespan\": 2\n        },\n        {\n            \"name\": \"weather_dialog_params_address\",\n            \"parameters\": {\n                \"date-time.original\": \"\",\n                \"address\": \"\",\n                \"date-time\": \"\",\n                \"address.original\": \"\"\n            },\n            \"lifespan\": 1\n        }\n    ]\n}\n```\n\nAnd then, the result is sent to the run method of the service `jeeves` endPoint which manage the rest of the process.\n\nAnd when the process is done, a response is generated to be send to the `api.api`.\n","funding_links":[],"categories":["资源"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrien2p%2Fnestjs-api-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrien2p%2Fnestjs-api-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrien2p%2Fnestjs-api-ai/lists"}