Daily Update from DialogFlow fulfillment python in google assistant - python

I'm developing an application with Dialogflow and Actions on Google which requires to send daily birthday notification in Google Assistant.
I'm following this documentation to send daily updates. But I'm having trouble because of the language barrier.
I'm developing backed in Python and using fulfillment to serve the request, but that documentation is in Node.js. So I need help to send daily updates.
I've done up to Console setup. Please guide me for further process.(Which JSON req. should I sent?)

If you look down that documentation page a bit here and click the JSON tab, you'll see the specific format you need to configure the subscription to your birthday updates.
Since you're not using a client library, you'll need to write the Python code yourself to respond with the appropriate JSON.

Related

Writing Twiml based on user messages

First post on here. Im working on an application in python using the twilio voice api. Id need to be able to create twiml xml data based on user messages. Hence twiml creation and hosting programmatically on the fly. Is there anyone here that can point me in the right direction. For all i know twilml bin doesnt allow that. Thank you
Twilio developer evangelist here.
You are right that TwiML Bins don't allow to generate dynamic responses (outside of some light templating). However, you are building with Python, so you can build a web application that responds to Twilio webhooks with dynamically generated TwiML.
I'd recommend working through this tutorial on receiving and responding to incoming SMS messages in Python to understand how the process works and how to use the Twilio Python library to generate dynamic TwiML.

How can I show data from my personal API to a gauge dashboard without a DB?

I’m new here and I’m trying to learn as good as how to use Grafana for University IoT project. I’m written an API that returns data from a gyroscope. I want to use grafana to show live data into a dashboard but without using a database: I’m using JSON to send data from server to client but I don’t know how can show it. Can someone help me?
Thanks in advance.
Adapt your application backend service to support API for Simple JSON Datasource (look at numerous implementations of it on Github for examples).
Install simple-json-datasource plugin in Grafana and setup it to use your application's API endpoint.

Upgrading Facebook Ads token to "Basic"

I am developing an app using the Facebook Ads api. Initially it is just a Python script which downloads ads performance information from my client and stores it in a database, where it is combined with information from other sources in order to provide better reporting for them.
It is not a web app (yet). It is just a Python script, working for a single business user account (yet!).
The developer token clearly isn't enough because it limits access to 5 Ads Accounts. I would like to upgrade to basic account however the approval form requires things such as providing a video demo, website of the app, privacy policy, etc. The app doesn't have those because it is not intended for general use (yet!!).
It seems that only an app focused on other Facebook users can apply to a Basic access token.
Is this so?
How can I upgrade my access token if my app is just a Python script running on a server?
Thank you! :-)
Okay, so I just ended up filling the form and when asked for instructions of how to run the demo I explained that the app wasn't "demonstrable".
And the app tier was upgraded automatically.

RESTful API and Google Analytics

I'm running an RESTful API with Python (Flask).
I want to be able to track:
which requests have been made
when did those requests happen
how long did it take to send the response
I want to use Google Analytics for this, because of it's nice dashboard and extended functionalities.
My question
How can I implement Google Analytics into a REST API?
OR does anyone know another tool/library that can be implemented?
This is what I found at the moment:
a tracking app that uses MongoDB
the Google data API - but this is for reading GA data, not tracking the API?
There are actually two ways to send server-side data to Google Analytics. The standard method is the GIF Image Request API, which is the same API that ga.js uses on the client-side. Google has started developing a new REST API known as the Measurement Protocol, but this is only in developer preview.
Server-Side GA
There are a few issues to work through when trying to send server-side data to GA.
Like #mehaase pointed out above, the gif API takes the ip address from the request, so all of your server-side requests will appear as users coming from the location of your servers. The measurement protocol doesn't let you change the request's ip either. I'll assume the publicly available gif API in this answer.
Another issue is that the gif endpoint requires a client-side cookie. You can fake this cookie on every request but this will cause each event to look like a new visitor. That's fine as long as you keep the server-side API and website in separate Google Analytics profiles.
Also beware that Google can take up to an hour to show your events once you've sent them. This can make debugging a bit painful, so be patient.
Here's the breakdown of what each variable in the GA cookie means, and a good node.js example of sending server-side data to GA.
Other Event Tracking Options
Even though GA is excellent for tracking website metrics, it's not built for tracking server-side events. A category of analytics known as event tracking is the perfect application for restful API usage tracking.
The API generally looks like this:
analytics.track('API Response', {
method : 'POST',
endpoint: '/comments'
duration: 124
status : 500
});
And lets you see reports on the frequencies and distributions of each event and event property You can answer questions like: how many /comments API calls happened today? How many were 200s? How many had a response higher than 200ms? etc.
Here are some event tracking tools that can help you do this:
Mixpanel
KissMetrics
Keen.IO
I'm the co-founder of Segment.io, a company that provides a simple API for client-side, server-side and mobile analytics. We let you send data from python, php, ruby, node, java, .net, javascript, and iOS, and we'll forward it to Google Analytics, Mixpanel, KissMetrics, Keen.IO, or any of our other supported services without you having to learn their API.
And finally, here's an article from our analytics academy that explains why event tracking is useful.
I know this is very old post. I came across google analytics support in Python
https://developers.google.com/api-client-library/python/apis/analytics/v3
Thought this is right place to document as well (y)

Is it possible to use GCM with a python GAE backend?

I have a python GAE service, and I want to push notifications from the server to devices. The tutorial available for GCM is written for Java, and runs on ant+Tomcat/Jetty+JAE. I was under the impression that GCM would be a language-agnostic web service, and that I would be able to send push notifications regarding of my server-side platform.
Was I mistaken about GCM being compatible with my python GAE
backend?
If I CAN use it with my existing server, what instructions
can I follow (or adapt) to get started with sending notifications to
a mobile client?
Sure you can. GCM has a JSON REST API that you can work against. First you need to register you project here: http://developer.android.com/google/gcm/gs.html.
You basically do this:
Acquire you API key from http://developer.android.com/google/gcm/gs.html#access-key
Construct your payload, a dict containing registration_ids, data etc
Using url.fetch https://developers.google.com/appengine/docs/python/urlfetch/ to send the data as a JSON string to the GCM API
Here's another question with some code. Google Cloud Messaging HTTP Error 400: Bad Request and a blogpost (in not english, i think spanish. but there some sample code) http://pforray.wordpress.com/2012/07/05/ejemplo-gcm-en-appengine-python/
Use gcm-client
pip install gcm-client
Reference:
https://pypi.python.org/pypi/gcm-client/
Here you can find a module for Python interface for sending push notifications via Pushwoosh.
https://github.com/dbtsai/python-pushwoosh
You can use it for sending messages via Pushwoosh (it's free) or adapt it for your needs.

Categories