How receive response from web servcie in appsheet

Hello
There is a web service that optimizes routes. So you feed it a list of GPS lats and longs, and it returns the list in the order that costs the least amount of fuel, shortest distance or something.

Question: How can I capture any response that comes back from calling the web service from inside my app? I looked at webhooks but it didnt seem possible there.

0 13 3,767
13 REPLIES 13

At the moment we do not have a way for you to make HTTP Get calls and process the responses.

any changes on this ?

Yes! Call Apps Script from an automation including return a value to your app.

@David_Joyce
As thereโ€™s no HTTP GET call feature in AppSheet right at the moment, the only possibility is constucting your own webhook endpoint with Google Apps Scripting, passing your Lat/Long pairs to this webhook in a JSON payload and then make a UrlFetchApp call to this REST API service within this webhook. Then you have 2 options to record the response to your back-end:

  • Directly to your gSheet using Sheets v4 API
  • Using AppSheet API

Could you provide a little more info, or an example, on how to record the response, please?

My backend is a MySQL db running on Amazon RDS instance. The main table in the data has a column ("_Order") set to store the route order number.

@David_Joyce
I would like to, but the option I have advised is problem/user/app specific, so itโ€™s a bit hard to exemplify it. Also I have no idea about the REST API service that you are using and the type and structure of the response that the service returns. Besides I have no idea about your app structure.

As your back-end is SQL, than you need to construct an ODBC connection and pass the response with SQL QUERY to your table. Or use AppSheet API directly.

I faced a problem which unable to make HTTP GET calls.

Can you elaborate more how you handle it ? For example, multiple users are making the enquiry from the mobile apps. Then, the Apps needs to GET the result for them and reply to them in real-time manner.

Thanks.

Hi @David_Joyce

Iโ€™ve used services like Zapier and Integromat to process the responses from GET requests. Itโ€™s not ideal, but it gets the job done.

I have an AppSheet webhook fire the data to Zapier, then Zapier takes that data and fires the GET to my other System. I can then handle the response data in Zapier and send it back to AppSheet via the AppSheet API or back to a database or sheet. Any of those options make the data accessable to an AppSheet app.

My thought is that you will end up needing to have multiple rows added or updated in the end, so I would try Integromat for that. They have better loop operations.

At only one point I donโ€™t agree with using 3rd party services: generally they are not well documented and they are free only with some basic integrations and then youโ€™re asked to switch off to a paid-subscription i.e. Zapier. To use webhooks with Zapier you need to pay $25 per month. And to get the correct structuring you need to spend a good amount of time with a lot of trials and errors as the service is not well documented enough. Besides, to make a REST/SOAP API connection, you should at least have a command of programming to structure the JSON (or whatever connection string is necessary) body correctly and effectively.

Hi

I am trying to use google vison API (OCR option to extract text from a photo )

But i do not know how to built the HTTP message to google API
Can you help me

Thanks in advance

Etienne

Do you happen to have an example of how to parse an event object from AppSheet that gets sent via webhook to a Google Apps Script? I keep getting a โ€œcannot read property X from undefinedโ€ error when my GAS doPost(e) function gets triggered. Iโ€™ve tried e.Payload (based on the Audit Log in AppSheet) with and without JSON.parse(), among other things, and I keep getting undefined. I just need to know the syntax!

Oh I know that feeling!

Appsheet webhook specification:

doPost() :

function doPost(e) {    

    var cont = e.postData.contents //a string that looks like '{"var1" : "val1" , "var2" : "val2" }'

    var parse = JSON.parse(cont)  //converts the above string into a JS object {var1=val1 , var2=val2}

    var action = parse.action  //or parse["action"]
    var type = parse["type"]   //or parse.type
  
}

Thank you, thank you! Exactly what I neededโ€ฆ

Top Labels in this Space