title: how to integrate dialogflow result to linebot (Node.js)?
body: <p>I am creating the chatbot(Line) integrate the Google Dialogflow using node.js.</p>
  
  <p>I can create the line chatbot from user input the text and echo some text, only.</p>
  
  <p>And I can create the code from user input send command to Google Dialogflow, and dialogflow using 
  the NLU tech response text to the user.</p>
  
  <p>But I need user input the text send to the dialogflow and  response the text(A) , then send the text(A)(after code add some template button's code) to Line bot create show some template button to user.</p>
  
  <p>How can I integrate two part code achieve user input text and through dialogflow result , using the result send to the line bot server?</p>
  
  <p>user input -> dialogflow ->mycode(add some template button call line) ->linbot ->bot show template button to user</p>
  
  <p>Thank you.</p>
  
  <p>//----------------------------------</p>
  
  <p><strong>My dialogflow code:</strong></p>
  
  <pre><code>var express = require('express');
  var bodyParser = require('body-parser'); 
  var app = express();
  app.use(
      bodyParser.urlencoded({
          extended: true
      })
  )
  
  app.use(
      bodyParser.json()
  )
  
  
  
  app.post("/webhook", function(req,res){
      console.log(JSON.stringify(req.body, null, 2))
      var intent = req.body.queryResult.intent.displayName;
      var entityCity =  req.body.queryResult.parameters["geo-city"];
  
      if(intent === 'myIntent')
      {
         //  here I need call bot.on method, but I don't known how to do.
         // return res.json({
              fulfillmentText: `I known your mean.`
          });
      }
      else
      {
          return res.json({
              fulfillmentText: `i am not sure your mean`
          });
      }
  })
  
  app.listen(process.env.PORT || 5566, function(){
      console.log('server start ...');
  })
  </code></pre>
  
  <p>//----------------------------------</p>
  
  <p><strong>My Line chatbot code:</strong></p>
  
  <pre><code>var linebot = require('linebot');
  var express = require('express');
  var app = express();
  
  const bot = linebot({
      channelId: 'mychannelId',
      channelSecret: 'mychannelSecret',
      channelAccessToken: 'mychannelAccessToken'
  });
  
  bot.on('message',function(event) {
      console.log('bot');
    console.log(event); 
    var msg = event.message.text;
    // here can add some template button code and reply to user.
   });
  
   const linebotParser = bot.parser();
  app.post('/webhook', linebotParser);
  
  var server = app.listen(process.env.PORT || 8080, function() {
    var port = server.address().port;
  
  });
  </code></pre>
  
  <p>//--------------------</p>
  
  <p><strong>My Line chatbot code other version:</strong></p>
  
  <pre><code>const line = require('@line/bot-sdk');
  const express = require('express');
  const lineConfig = {
    channelAccessToken: process.env.HEROKU_LINE_CHANNEL_ACCESS_TOKEN,
    channelSecret: process.env.HEROKU_LINE_CHANNEL_SECRET
  };
  const client = new line.Client(lineConfig);
  const app = express();
  app.post('/webhook', line.middleware(lineConfig), function(req, res) {
    Promise
      .all(req.body.events.map(handleEvent))
      .then(function(result) {
        res.json(result);
      });
  });
  function handleEvent(event) {
    switch (event.type) {
      case 'join':
      case 'follow':
        return client.replyMessage(event.replyToken, {
          type: 'text',
          text: 'hello~'
        });   
      case 'message':
        switch (event.message.type) {
          case 'text':
            return client.replyMessage(event.replyToken, {
              type: 'text',
              text: (event.message.text+'~yu')
            });
        }
    }
  }
  app.listen(process.env.PORT || 3000, function(){
    console.log("Express server listening on port %d in %s mode", this.address().port, app.settings.env);
  });
  </code></pre>