Dialogflow minimal viable product - android

I am trying to create the bare minimum of a chatbot with dialogflow in an Android app. Initially I do not need the bot to hook into things or have context and entities. I just want it to match questions with answers as good as it can.
I do not come from the web world so this https://dialogflow.com/docs/getting-started/basic-fulfillment-conversation confuses me. The final part of the tutorial is not finished and it leaves me hanging a bit.
As an Android dev I want the app to:
call a rest api with the user text
or possibly:
invoke an SDK and have a local pretrained agent and not involve the internet an all
You can download the Agent but that is just some json files. I found an Dialogflow.SDK but it seems to be related to speech. In the dialog flow console you can 'copy curl':
curl 'https://api.dialogflow.com/v1/query?v=20170712&query=Hi&lang=en&sessionId=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx' -H 'Authorization:Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'
I want to access the agent like that from multiple instances of an app.
Do you always need a 'fulfillment'?
The guide mentions creating folders on your local machine(in conjunction with fulfillment) are these only used to do a 'deploy' from your local machine to configure the web hook in the cloud? Or are they also used to deploy the entire Agent to the cloud project? (which i can't seem to find any instructions for, unless it's the same as for webhooks?)
gcloud beta functions deploy weatherWebhook --stage-bucket [BUCKET_NAME] --trigger-http
I have read questions with both tags DialogFlow and Android but most of them seem to involve Google Android Assistent which I have no interest in.

You do not need fulfillment. This is primarily for Dialogflow to take advanced actions or to use more complicated logic to handle the response.
You also cannot run Dialogflow processing on your device - all operations take place in the cloud. So you don't need to download the zip file unless you want to make a backup copy of your agent.
The REST interface you're looking for is the one you found. It handles more than speech - the /query endpoint can take a query parameter which contains "Natural language text to be processed."

Related

Create SDK/API using Parse.Com

I got an assignment to write a SDK/API for a mobile app, which will be developed in all 3 platforms(Android/Windows/iOS) by different persons. Since those mobile app developers are outside companies, my company doesn't want to expose any Data Base structure related information to them.
So they wanted me to use Parse.com as back-end. I was playing with Parse.Com last whole week. But following things are still unclear to me. Hope there could be someone who could help
Once I go to create an app on Parse.Com it binds me to a specific
platform so is there a way I could refer data (classes) on one app to
the other ?
Is there any way I could expose only few functions out side (like
GetProductList(), GetOrders()... ) world irrespective of target OS ?
Making an app on Parse.com won't bind you to a specific platform. While in the Parse dashboard, go to settings -> keys to find the keys you need to access your Parse server for whatever platform you are coding. Parse objects are JSON encoded.
You can add javascript functions to your server via Parse's Cloud Code. These functions can be called via multiple languages. Check out the following links to add javascript functions to your server:
https://parse.com/docs/cloud_code_guide
https://parse.com/docs/js_guide

Developing a server to host a smartphone app content

Im building this app (using Unity3d) for a city hall and I need to split the content from the actual app since content must be easily changeable without having to update the app itself.
I want to host the content on a server and use http get/post messages to retrieve the data. I also need to have a web editor (kinda like a CMS) so that the client can change the content himself.
In the editor I would just have a list of "rooms", where each "room" would be one of three types (i.e. text screen, slideshow or audio). Depending on what type the room is, different parameters should be visible and editable.
What language you suggest I write the server in? (the server that the app would contact in order to obtain the up-to-date content) Python i'm guessing here?
What would be the easiest way to build the browser editor? Javascript and django?
If you know Python already and don't want to have to support maintaining a web server for your client it would probably be easy to host the web portion of your app on Google's App Engine. It's relatively easy to use App Engine to serve a simple a web form where the client could edit content and upload binaries. The form could be built using Jinja or Django-style templates, and the data would be written to App Engine's datastore. (also, it's easy to restrict access to the form to app administrators to prevent accidental/malicious edits)
Then the Unity app would query a page on the App Engine server to see if there's new content using the WWW object. The server would make a quick memcache/datastore query and return a JSON response telling Unity if there's more stuff to download or not.
I've done all of this in past projects, so I'm sure it's workable, and a lot of relevant code can be found in App Engine's tutorials and via some light Googling.
I would also look at Wordpress as a CMS. You can create custom forms for different post types. Each "room" type could also be a category type and have custom fields for data to be inputed.
There are loads of plugins to get up and running without too much coding. But you can also dig in and customize with some PHP coding.
The great thing about Wordpress is that media handling, Database interface, user management, privilege and editorial controls, to hand off to a client, are all there. There are loads of tutorials and documentation to get the platform to work for your needs.
Android get connected easily with cloud server.I don't know about others. You can connect using JSON and PHP for this.
You can use .net platform as an backend server.
You could also build Webservices. On my project we work with it. You could also do it with PHP. Try this link: Androidhive.info/how-to-connect-android-with-php

Extending an existing Web application with Android app

I have a new project involving the build of an Android app for a website of a hiking club. The website has a login functionality after which the user can browse through available hikes, subscribe to a hike, view the other subscribers, contact the organizer etc.
The original site is based on a MySQL database with a front end of .asp pages. Most data is passed through the pages as GET parameters on the query string.
New to Android development, some things really puzzle me, even after reading several tutorials. I am thinking towards an architecture baes on REST webservices but there a several obstacles to overcome and chooses to be made.
Apart from using REST, some other options are available:
Call the original .asp pages from the app instead of building a dedicated Web service. This leaves me with much less code to write, the original business logic (queries e.a.) as well as the login system can be used (with the "remember me" functionality based on cookies). Downside is that the (X)HTML code in the response needs to be parsed to show in the app GUI, where the majority of the response code is useless ballast code. Also, it does not feel very good from an archtitectorial point of view.
Using a SOAP based webservice. I am totally unfamiliar with SOAP and it appears to be much too heavyweight for a mobile device.
Using REST services. I am leaning towards this option, and have made
some already working services using the SLIM framework. But there
are some problems. First, REST is stateless by definition and does
not seem to support sessions. But the "Remember me" option is
required for the app after login in for the first time, the user
needs not to login again unless he explicitly logs out.
But how can we achieve that?
First option is to designing some completely client-site login/logout system which saves the credentials locally until the user logs out. And sending the credentials with each request to the Web service as POST parameters, or somehow in the HTTP Authorization request header, though I am not familiar with that.
Second option is to deviate a bit from RESt principles and use a session mechanism anyway. After sending the credentials to the web service, a cookie is created and send to the client app. The dartabase cannot be extended so there is no option to save a token in the user table. Maybe the usernae/password can be encrypted and send as a cookie to the app, and decrypted at each subsequent request?
I am a bit lost in this, and look forward to serious suggestions!
I believe that from a long term perspective, it is important that you lean towards REST Interfaces. While JSoup and/or WebView approaches will definitely work, it is important to have the flexibility to redefine/design the mobile application in ways that are completely agnostic of the Server side. REST will help you there and you do not need to play catch up with the Server side, everytime they change the HTML pages, etc.
Going REST will also help in future with writing additional mobile applications and even on different platforms like iOS, if your roadmap contains that.
You can use jsoup to parse the html pages from your Android app and reorganize the information of the web page, this option will gives you ability to quickly develop an App, later you may think on add REST interfaces to your web site and populate data in json.
You can also use WebView to laod your web pages if you don't want to parse html pages.
I suggest you using REST architecture as you said. You can use a rest client library for Android as RESTDroid, take a look to the guide because there is a implementation example with special header needed for the particular web service used (Parse.com in this case).

Just cant integrate DRUPAL and ANDROID

I am using Drupal to create a web service for my android application.
I have basic understanding of Drupal like enabling modules , themes , configuring them ;
But this "Services" module is the one which I can not get in head.
I downloaded services 6.2 and enabled services module and node services module
Now when I navigate to site building -> services -> node.get
I get a form in which I can enter the node id and fields and this is working fine.
But I don't know how to get the response from android.
I have not yet enabled xmlRPC server.
I have enabled the anonymous user to visit the services page so that I don't need to get authentication or session id.
Basically I just want to see the response in my log cat in eclipse sdk for just node 1
and I will be set to go from that point.
Services module allow using remote protocols (xmlrpc, soap, rest, etc) to communicate third-party app with Drupal.
To use it, you need to define at least one endpoint. Setup name, protocol, allowed resources (nodes, users, files, comments, etc).
For example, define xmlrpc endpoint.
Then you can call it from xmlrpc client on Android.
xml-rpc exposes a set of remote methods, the most interesting are:
user.login - logs in user, it takes username and password as arguments
user.logout - logout
Node CRUD operations:
node.retrieve - retrieve
node.create - create a new node
node.update - update existing node
node.delete - delete node
node.index - get list of nodes
The same CRUD methods exists for other Drupal objects (files, comments, users, taxonomy_terms), only replace "node" to object name.
For example: "file.create" - create file, "file.index" - retrieve list of files, and etc
If you need to authorize, you need to call "user.login" first, and if call is succeeded,
store sessid and session_name values of returned method structure.
Then send value
session_name+"="+sessid
as cookie in all subsequent calls to identify the session. Also, you must enable "session authentication" checkbox in Drupal service endpoint configuration. Without it, all requests to endpoint will be executed as anonymous user.
To make your own xmlrpc service, you need to define hook_xmlrpc in your module, and expose a set of methods.
See the Services documentation at http://drupal.org/node/783722 and http://drupal.org/node/790416 for some examples to get you started. I find these give a good introduction on how to setup and use the Services module.
I'm not sure if this is what you are looking for, but you could use an HttpClient to access your service. See this answer for more help. Since I am not a Drupal expert, I'm not sure if you need to enable or disable xmlRPC since you have enabled these "Service" modules. With a little research (here) I did find some useful information that basically says enable xmlRPC on Drupal and import an XML-RPC client into your Android application to begin using it.
The question has been answered but I am adding what I found to be an excellent Video tutorial to integrate Drupal site with Android App.
http://www.youtube.com/watch?v=ezk_21sfEQM

How does Funambol work?

I'm developing a android application for a customer which involves capturing data on the handset and then synchronizing it later to a server. They want me to use Funambol server and client to sync data. I have tried looking up on the www.funambol.com website for any api and documentation, but am not able to find any library for android.
Has anyone done any similar work using funambol? I need to sync a list of customers and their related data which will be entered by a salesman.
Thanks
Funambol has a syncml api for android that is used in the Android client, and can be used for performing the sync without the need of implementing syncml. You will only need to work on client and server side to implement the proper syncsource for your specific data, and store the data on both sides.
Take a look at https://www.forge.funambol.org/download/ (bottom of the page)
The developer community can be reached at bit.ly/fun-open-discuss, where you can discuss development topics and share your project and code (as required by AGPL).
Funambol provides open source-based solutions for push email & PIM sync as well as device management and a platform for mobilizing apps and data. Funambol is based on the SyncML (OMA DS) standard for data synchronization.
Read the FAQ

Categories

Resources