title: How to make asynchronous calls from external services to actions on google?
body: <p>I'm trying to connect Google Home to an external chatbot with actionssdk. I have an API that take user inputs and send them to my chatbot with webhook, but my chatbot make a response calling another endpoint of my API in an async way, and I can't show the response in actions on Google or Google Home. </p>
  
  <p>I create an actionssdkApp.</p>
  
  <pre><code>const {
    actionssdk,
    SimpleResponse,
    Image,
  } = require('actions-on-google');
  var app = actionssdk();
  var express_app = express();
  </code></pre>
  
  <p>My API has 2 endpoints. One of them is for actions on google to send user inputs to my chatbot:</p>
  
  <pre><code>app.intent('actions.intent.MAIN', conv =&gt; {
    console.log('entra en main');
    conv.ask('Hi, how is it going?');
  });
  
  app.intent('actions.intent.TEXT', (conv, input) =&gt; {
    var userId = conv.body.user.userId;
    console.log(userId);
  
    if(userId &amp;&amp; input){
      textFound(conv, input, userId);
    }else{
      textnotFound(conv);
    }
  });
  </code></pre>
  
  <p>TextFound function send user inputs to my chatbot with webhook, but the request doesn't receive the response. My chatbot call another endpoint with the text answer:</p>
  
  <pre><code>express_app.post('/webhook', bodyParser.json(), (req, res)=&gt;{
    console.log("Webhook");
    const userId = req.body.userId;
    if (!userId) {
      return res.status(400).send('Missing User ID');
    }
    console.log(req.body);
    res.sendStatus(200);
  });
  </code></pre>
  
  <p>And here is where I want to send the answer to Google Home. But I need the conv object to show the answer in google Home, or actions on google, or any other device.</p>
  
  <p>Edit:</p>
  
  <p>My <code>textFound</code> function:</p>
  
  <pre><code>webhook.messageToBot(metadata.channelUrl, metadata.channelSecretKey, userId, input, function(err){
          if(err){
              console.log('Error in sending message');
              conv.ask("Error in sending message");
          }else{
              conv.ask("some text");
          }
      });
  </code></pre>
  
  <p>From here my api send user inputs to my bot through <code>messageToBot</code> function:</p>
  
  <pre><code>request.post({
      uri: channelUrl,
      headers: headers,
      body: body,
      timeout: 60000,
      followAllRedirects: true,
      followOriginalHttpMethod: true,
      callback: function(err, res, body) {
          if (err) {                    
              console.log('err: '+err);
              callback(err);
          } else {
              console.log('Message sent');
              callback(null);
          }
      }
  }); 
  </code></pre>
  
  <p>From now on, my bot doesn't send a response but makes a call to <code>/webhook</code> endpoint of my api with the answer. But in this function I haven't de conv object and I can't send the answer to google. I don't know how to access to this object. Maybe there is an uri to connect with my project in actions on google from my api. </p>