I want to access an external Google API through a GAS trigger. Is it possible/advisable to use something like the javascript Google API client library, adapted for the GAS context, instead of manually using URL Fetch, as mentioned here ?
PS. I am trying to hit the Google App Engine TaskQueue service via its REST API.
In the Apps Script Code Editor, under the RESOURCES, ADVANCED GOOGLE SERVICES menu, you can enable different API's. I don't see an Advanced Service for anything the resembles a Task Queue. There is a Tasks API, but that's for Task List, which is very different than the Task Queue.
So, I don't think you have any choice but to use the REST API with UrlFetchApp.fetch() in server side gs code in Apps Script.
As far as the trigger is concerned, you might want to look at quota limits, if you're going to be running it a lot, or running code that takes a long time to run.
You can use external APIs with OAUTH2 as outlined here: apps-script-oauth2
It's just not built-in, but you can easily add it as a library as mentioned in the Readme.
Related
I was writing some emails and sending them via Gmail API, I was trying to schedule them for the but through the Gmail API but I couldn't find any relevant documentation. Which make me wonder that is that even possible.
Answer:
The Gmail API does not have email scheduling functionality at present.
More Information:
There is already a report on Google's Issue Tracker which requests for this functionality to be exposed via the Gmail API:
Expose functionality for creating scheduled emails
Google does seem to know about this already, if it's a feature you would like to see be implemented sooner then I suggest that you hit the ☆ next to the issue number in the top left of the page, as it lets Google know more people would like to see the featureand so it is more likely to be seen to faster.
Workaround:
If you know at which time you would like your emails to be scheduled, and you have already authorised your application, then you can instead run your application using a cron job for your operating system.
References;
cron - Wikipedia
I have to maintain a database on the Google Cloud Platform and along with it put in a script(preferably in python) that is automated to put in new values from an API on a daily basis.
I'm confused as to how to go about this. Any suggestions?
You can take advantage of the App Engine platform which allow you to deploy a python application. It can be set to simply await instructions from your API or fetch the information directly. With the help of CRON, you can schedule task that should take care of pushing the object within your Database.
Another option would be the Cloud Functions. Currently Cloud Functions only handles the Nodejs runtime but it allows you to run a backend application that only runs when triggered. With a simple HTTP trigger from your API, your function should handle the data received and organize it before storing it in your Database.
Other options are available like Cloud Endpoints, Database (Spanner, Cloud SQL, Cloud PostgreSQL, Bigtable,) API, etc. All depends of semantics of your project (Will it be run only once daily, how fast does the whole operation has to be completed, etc.). I would suggest to review all of Google CLoud products in order to find the right solution for you.
We want to somehow consume a Chatbot Analytics so we can create our Own Analytics site for our Clients.
Is that any Possible?
Are there Any tools that will help?
We don't want tools, we want to consume their Data and Present them in our own site on behalf of our Clients.
Conside creating Chatbot via Chatfuel, API.ai or something.
You can use chatbotproxy.com API to fetch app and page specific metrics.
Currently, it collects 10 metrics, Note: if there is no data; then API does not return 0, it skips keys with 0 count. ChatbotProxy Metrics
We don't want tools, we want to consume their Data and Present them in our own site on behalf of our Clients.
By assuming you are referring consumer response as Data, yes that is possible.
To gather that data you should use AWS cloud services; you can use AWS Lex and AWS Lambda to build chatbot. In AWS ecosystem,you build the skeleton with Lex and provide functionality using Lambda function which will be triggered on catching an intent.
Considering you want to do some custom analysis on your consumer's responses AWS provides the best solution. AWS implementations are more flexible, transparent and their SDKs are available for a diverse set of platforms.
If your bot is created using api.ai, unfortunately, there's no way to consume analytics data via API calls, instead, they have developed & announced Analytics dashboard in api.ai console. Here, you can review statistics relevant to the specific agent. The solution to your problem can be logging everything via webhooks and write your own analytics service, but you'd probably know that already.
I am somewhat new to Web development - specifically Google App Engine and JavaScript/HTML development, but I have an app deployed and working on Google App Engine and it is working ok.
I would like a user of my App to be able to store and retrieve a serialization of the app state in JSON using the GAE Datastore. (Note - This is only a user-initiated action - so channels seem to be overkill)
The examples provided by Google demonstrates one approach that allows the server-side Python implementation to do this. Specifically https://developers.google.com/appengine/docs/python/gettingstartedpython27/usingdatastore. I have this working ok.
But this approach seems rather inelegant especially if as an "app" I want to store and retrieve serialized chunks of data somewhat asynchronously without reloading the page/app each time (again, this is only ever user-initiated).
I have not been able to find any high-level guidance on an approach to do that (assuming it is possible).
Any suggestions/links/examples would be greatly appreciated.
Thank you!
Jeff
As with many things, this depends on your specific needs. If you just want direct access to datastore storage, the datastore is exposed as an independent service with an API.
If you instead want to assert logic over the usage and interact with your app in some fashion, you may also want to look at Google Cloud Endpoints. With an endpoints API, you gain a more structured API you can call directly from javascript, or generate client libraries to be consumed by other languages/platforms.
I am developing a GWT application on google app engine and I am looking for the best approach to initialize objects (like singleton, list, shared resources etc).
I guess I am looking for something like "Spring application context file"
any ideas?
What you're looking for is here:
http://code.google.com/appengine/docs/java/config/appconfig.html#Using_a_ServletContextListener
Basically, you're going to make a Servlet Context Listener, which is a part of the servlet API designed for exactly what you're referring to. If you're running this locally, it will run when you start your server. In the app engine environment it should run for every warm up request (to avoid, this, you can use "Always ON", which will be set here: http://code.google.com/appengine/docs/adminconsole/instances.html#Always_On)
Besides ServletContextListener you can also use <load-on-startup> to mark your normal servlet to be invoked during a warmup request.