How do I let the user set a variable with Alexa? - amazon

For example, I would like the user to be able to set their home location as a 6 digit number. Then they can just ask my skill for an update, "when's the next bus coming", rather than having to say, "when's the next bus coming to location 123456".

You can persist information using either a database or by passing information along in the session object. There are lots of examples and information about using DynamoDB, such as this Alexa cookbook example.
The session object allows passing data along from each intent to the next, but only persists for the life of the session. The Amazon documentation contains the information about session, but the specifics will depend on the language you are using (eg. Java or NodeJS)

Related

Getting a list of BuildFire plugin users from the Widget side

I am developing a plugin that allows the user the post content that I am storing in an object in publicData. To identify the user that posted the data, I am storing the _id that is returned from buildfire.auth.getCurrentUser() in that publicData object along with the content of the post.
Is there a way I can access a list of the users of my plugin, then iterate through that to find the user with the corresponding _id? A list of the users of my plugin must exist somewhere, I just do not know how to/if I can access it.
Any help on this would be greatly appreciated!
I would recommend caching the user object's nonsensitive data. Remember, you have a bit more access to the logged-in user over fetching another user profile using the user id. https://github.com/BuildFire/sdk/wiki/How-to-use-Auth#buildfireauth-getuserprofileoptionscallback
Since the user profile picture URL is really an API, you don't have to worry about the user changing it since it will always return the latest. The other property I recommend you cache is the Display name (not the first name and last name) since that rarely changes as well. This way your performance wont suffer and you can do a lazy fetch for a distinct list of user ids an update them as needed. KNowing most wont need an UI updates since nothing changed

Dialogflow fulfillment - querying firebase with parameters from user

I am currently working on a dialogflow app for my company. I need to get our app to be able to take any name given by the user and match it to the database.
We manufacture CNC machines and we are attempting to create an application that allows the user to obtain information about their machine using their phone or google home. We have a website that allows them to give their machine a name. This name could be anything. It could be "Zodiac", or it could be "ZMachine #123". This name is stored in the database and is used to reference the machine from the dialogflow app. However, when google parses the voice input, and I get that entity in the fulfilment, I end up with "z machine number 123" or something like that, which I cannot match to the database directly. This is especially true for names that are not standard English words or names, such as a company name or something like that.
I was wondering if anyone had any resources that could point me in the right direction? I noticed that when you name smart devices in google, you can name them anything you like and it still gets it right. What are they doing in the background that allows this to take place?

Stored Value Sets that are accessed throughout a Bixby Voice Experience

I am completely new to Bixby development so I apologize in advance if this is a newby question that doesn't make sense. I'm trying to understand the best way to store value sets returned from external APIs to use throughout Bixby Voice experiences. An example might be an API that gets all the menu items at a restaurant or an API that gets all the clothing catalog items from a store. When users interact with the data to search or transact I don't want to have to go back to the external API to get the value set again. For example: Find Vegan Menu options followed by Okay how about pescatarian options. Or: Find dress pants followed by okay how about dress shirts. I'd like to come back to a menu object in the first case or a catalog object in the second without having to re-load the value sets from the API.
In the sample code I've seen all of the value sets appear to be read in each time an action/endpoint/java call is made
There is no local storage in the current version of Bixby.
The easiest solution is to request through API calls. However, http.getUrl() itself is cached by default, and Bixby runs on Samsung server, so no actual API calls in practice when requesting same url in short sessions.
You can read more about http API options and how to disable cache feature by reading more here

Best way to store text submitted to a Node app from Twilio

I want to make an app where people can text (sms) their name to sign a petition and then their name would be added to a list of signees on a website for the petition.
The sms messages would be handled by Twilio and then be processed by a Node.js app. I would like to use Angular on the front end.
Question: What would be the best way to store the names? Do I need something like MongoDB or would a database be overkill? I'd also like to verify that only one name per phone number is entered.
If you don't use a database you'll need to store it in memory. This will mean when you restart the server or it reboots you will lose your names.
So the short answer is yes you will need a database.
As for checking if there are duplicates there are many method with mongodb.
You can use a find query first to check that it does not exist already.
You could use upsert which will replace a previous one matching one.
However you can use any type of database that you wish.
I'd like to vote in favor of a relational database, probably it's a good fit for your kind of project.
Take in account that you can also store some interesting fields that comes with the Twilio request like country and state to list some.
You can take a look at this tutorial where not only you can get the SMS but reply to the user to have a smooth user experience in the process: https://www.twilio.com/docs/sms/tutorials/how-to-receive-and-reply-node-js

How to locally store user information when he is using facebook messenger chatbot?

I followed facebook's documentation and set up my messenger bot. It works fine when it's just me who's using it, but I don't know how to create variables and store information in them locally so that I can have individual information about each user.
For eg. If I ask them to type their phone number, how/where should I save it, so that it isn't overwritten if a new user comes and inputs his number (which happens, if the variable is declared globally), and I can also use it later.
I used Node JS and followed the steps they mentioned in the documentation.
You have node js server as a backend which can communicate to a (mysql/sqlite) database.
Fb provides senderId with each request and also there is another graph API for getting user's other information like Name, Age, Gender, profile pic link etc
https://graph.facebook.com/v2.6/SENDER_ID?access_token=YOUR_TOKEN
You can have a table in your (mysql/sqlite) database where you can store senderId as a unique key and other information including phone number (which you are getting by asking user) in other columns.
Here's the documentation link for public profile API.

Resources