How to use API in actions-on-google


I have tried the following javascript code, using a railway API in aog for getting names of trains between 2 stations.

train : function(conv,src,dst) {
const options={
    url : `${src}/dest/${dst}/date/23-09-2018/apikey/<api_key>/`,
    json : true
var data=[];
return rp(options)

    for(var i=0;i<2;i++){

    return conv.ask(data[0] + data[1]);
    console.log("api error" + err);

When I run it in my computer using terminal(node filename.js) it shows the data[] array with correct values. But when I try to run it from actions-on-google simulator it catches an error as follows...

api errorRequestError: Error: getaddrinfo ENOTFOUND

1 Answer: 

If you are trying to do this using Firebase Cloud Functions (FCF) or the Dialogflow Built-In editor (which uses FCF under the covers), the most likely cause is that you are using the free tier of FCF which does not allow calls outside Google's network.

You can upgrade to the Blaze Plan to get around this. While this does require a credit card to be on file, it includes a free tier which is quite sufficient for some basic testing and probably even some very light usage once you're in production. Once you have your Action approved, you will be eligible to receive cloud credits from Google which can be used to offset costs associated with using Cloud Functions.


More Articles

How do I force my Google home to download latest version of the local app

I'm developing the smart device handler using Google Home Local SDK. How do I force device to reload and restart the app? (now I have to unplug the power cord, it does not looks good as it sparks)also I have a couple of Google Home devices, how do I tell which of them should execute requests, is it

Xcode: App installation failed No code signature found

I want run app on real device ( iphone 6 or 8 )But i get this error : App installation failed No code signature found.I try all below solutions but not work for me:iOS app testing. App installation failed. No code signature foundMy xcode version is 9.2I'm tired :(

Google Smart Home Action: Account linking successful, SYNC response sent by fulfillment with status code 200 but Google Home app reporting error

I am building a Google Smart Home action with fulfillment hosted on AWS as a lambda function in node.js with the node implementation for Google Smart Home actions, exposed via AWS API gateway and an external OAuth 2 provider serving as authorizer for API gateway. My fulfilment includes SYNC, QUERY a

payment processing - pylons/python

I'm building an application that eventually needs to process cc #s. I'd like to handle it completely in my app, and then hand off the information securely to my payment gateway. Ideally the user would have no interaction with the payment gateway directly.Any thoughts? Is there an easier way?

Magento Payment methods are not showing in checkout

I have a website in magento. iam using payment methods paypal, bank transfer and stripe. using multi store view(3)Except paypal remaning payment methods are not showing in checkout process. i dont know what to do. please help me any one,Thanks,

Integrate with RBS WorldPay Hosted Payment Page (XML Redirect) using Python

Does anyone have any example code for integrating with RBS WorldPay using Python? Specifically posting the XML order to WorldPay

c# passing cookies as a parameter in sql

I am trying to save cookies on a login page pass it to another page where it will be used as a parameter in sql.saving cookies and redirecting to new page;HttpCookie cookie = new HttpCookie("UserID");cookie["UserID"] = reader["UserID"].ToString();Response.Cookies.Add(cookie);Response.Redirect("Home.

azure CloudBlobDirectory.ListBlobs() returns "The specified resource does not exist.", but fetchAttributes() works using same data

I am getting a "The specified resource does not exist" exception when I try to iterate the result of a ListBlobs() call. I can get the blob attributes when I access it directly, but I'm trying to get a list of all the blobs in the subdirectory.I wrote this little test to see exactly where the probl

IPN - PAYPAL No Return POST Data on Mobile

Many people are struggling with this one, when getting the return from PayPal there is no POST data if you use a mobile device (fine on desktop), so you can not run the IPN as there is no data to send.What do PayPal expect us to do, I have contacted PayPal support but they have not answered, this is

node.js - How to integrate Bpoint payment gateway in node js

I am new to node js. I want to integrate BPOINT payment gateway in my node js project. I have searched but did not get any result . Please help.