question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use the new v2 library ?

See original GitHub issue

At first, I’m sorry if the question seems silly. I’m getting used to Actions on Google + DialogFlow in the last couple of days. I found out this node package (v2) yesterday and I’m planning to use it for my DialogFlow webhook. One problem for me is the package just recently get updated to v2 and it seems like there’s no tutorial / instructions on how to use the new v2 library. Like, from the README file I can see:

const { dialogflow } = require('actions-on-google')
const app = dialogflow()

But what to do next with the app variable ? Given I’m using express.js to build my webhook.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
Iridiocommented, Apr 19, 2018

I think the OP would like an example with express:

I do the following inside the router class (in typescript)

import * as express from 'express'
import { dialogflow } from 'actions-on-google'

const app = dialogflow({ debug: true })

const router = express.Router()
router.use(app)

app.intent('The intent name not the action name!!!!', (conv, params) => {
    //Do something 
    conv.ask("my question")
or
    conv.close("my answer")
})
export = router
1reaction
Canaincommented, Apr 19, 2018

We also have a small snippet of a very basic self hosted express server in our v1 migration guide.

Here’s the snippet in case it’s helpful too:

const express = require('express');
const bodyParser = require('body-parser');
const { dialogflow } = require('actions-on-google');

const app = dialogflow();

// fulfillment code here

express().use(bodyParser.json(), app).listen(3000);
Read more comments on GitHub >

github_iconTop Results From Across the Web

HOW TO USE THE **NEW** RECALIBRATION LIBRARY IN ...
Today we dive into the NEW recalibration library in the Division 2.
Read more >
Using libraries - Beckhoff Information System - English
Referenced libraries; Library versions; Unambiguous access to library modules and variables; TwinCAT 2.x PLC Control libraries; External and internal ...
Read more >
How to use the new recalibration library in The Division 2
The Division 2's best new feature is open to all players, regardless of buying the expansion, and it's all about the recalibration station....
Read more >
Kinect v2 Processing library for Windows – Codigo Generativo
KinectPV2. Kinect v2 Processing library for Windows 8. A simple to use implementation for the Kinect v2 for Windows.
Read more >
Installing Libraries | Arduino Documentation
To install a new library into your Arduino IDE you can use the Library Manager (available from IDE version 1.6.2). Open the IDE...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found