Stored Value Sets that are accessed throughout a Bixby Voice Experience - bixby

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

Related

How to fetch third-party data within Twilio interactive voice system?

Twilio provides some documentation that explains how to create interactive voice experiences, for example, how to prompt for key-press from the caller and offer different menus or perform actions based on it.
However I cannot find any information on how I might be able to fetch data from a third-party service based on user input.
For example, suppose a user enters his zipcode into the keypad, I would like to fetch the weather from a weather API and return it to the user in speech form.
Is this possible? And if yes, how?
Very possible. You can take a look at the documentation below but the key widget is the HTTP Request Widget.
Studio Widget Library
https://www.twilio.com/docs/studio/widget-library#http-request
The relevant line is:
"JSON: If your HTTP Widget returns valid JSON, you should be able to access it via widgets.MY_WIDGET_NAME.parsed" variable.
Studio User Guide - Working with Variables
https://www.twilio.com/docs/studio/user-guide#working-with-variables

Track multiple context for the same Bot

We have a bot that will be used by different customers and depending on their database, sector of activity we're gonna have different answers from the bot and inputs from users. Intents etc will be the same for now we don't plan to make a custom bot for each customer.
What would be the best way to separate data per customer within Chatbase?
I'm not sure if we should use
A new API key for each customer (Do we have a limitation then?)
Differentiate them by the platform filter (seems to not be appropriated)
Differentiate them by the version filter (same it would feel a bit weird to me)
Using Custom Event, not sure how though
Example, in Dialogflow we pass the customer name/id as a context parameter.
Thank you for your question. You listed the two workarounds I would suggest, I will detail the pros/cons:
New API Key for each customer: Could become unwieldy to have to change bots everytime you want to look at a different users' metrics. You should also create a general api (bot) where you send all messages in order to get the aggregate metrics. This would mean making two api calls per message.
Differentiate by version filter: This would be the preferred method, however it could lengthen load times for your reports as your number of users grows. The advantage would be that all of your metrics are in one place, and they will be aggregated while only having to send one api call per message.

Is there a way to get Instagram #Mention History via API or otherwise?

The native application doesn't show all the activity, only the most recent.
Therefore I lose 70-90% of my notifications overnight. There must be a way to get all that historical data.
I told you can't, but, thinking.. you can. :)
The API don't provide that facility.. You can check all endpoints here: http://instagram.com/developer/endpoints/
But you can iterate over all your medias an get all comments and likes. If you store it locally, after, will be possible to request API again and check your new unseen interactions.
It will work for likes and comments.

How to grab instagram users based on a hashtag?

is there a way to grab instagram users based on a specific hashtag ?
I run contests based on re posting photos with specified hashtag then randomly pick a winner, i need a tool that can grab the usernames of those who reposted that photo and used that hashtag.
You can query instagram using the API. There are official clients for both python and ruby.
You didn't specify what language/platform you are using, so I'll give you the generic approach.
Query instagram using the Tag Recent Media endpoint.
In the response, you will receive a user object that has the user's username, id, profile url, and so on. This should be enough to do what you are describing.
As far as tools, there aren't great options to probably do things exactly how you want. If you just want a simple contest, you could use statigram, but it's not free.
If you roll your own solution, I highly recommend you also do the following:
Implement a rate limiting mechanism such as a task queue so you don't exceed your API calls (5000 per hour for most calls). Also useful for failures/network hicups, etc.
Have users authenticate so you can use OAuth to extend your API calls to 5000/per user/hour to get around #1.
Try the subscribe API if there won't be many items. You can subscribe to a specific tag as well, and you will get a change notification. At that point though you need to retrieve the actual media item(s), and this can cost a lot of API calls depending on how frequent and what volume these changes occur.
If your users don't have much photos/relatively small/known in advance, you can actually query the user's recent media instead and filter in your own code by hash tag.

Territory restrictions and linked tracks in Spotify

I am building an app that needs to know if a track is playable in the user's region.
It's easy to check the basic territorial restrictions of a track using the Metadata API. However, I am encountering tracks that the Metadata API says are out of my region, but are auto-linked to versions of the same track that aren't region locked. ie. Metadata says I can't play a track, but as far as the user is concerned, Spotify can play that track.
Here's an example:
'Sweet Unrest' by Apparat # spotify:track:4H4h3ulzjGVox14GHiCEoo
I am in the UK (territory code GB)
The lookup link is http://ws.spotify.com/lookup/1/.json?uri=spotify:track:4H4h3ulzjGVox14GHiCEoo
There is no GB code in the resulting territories string, so in theory, I should not be able to play the track. However, in the main Spotify player, I can see that it is auto linked to spotify:track:11S6TQybYumAnNApugZWSJ which is playable in my region. If I paste the supposedly unplayable track's URI into the top left Spotify search box, it plays.
Is there an API based way to check for tracks like this?
You can detect whether a track is playable or not using an undocumented property of each track: data.availableForPlayback
Track.fromURI("spotify:track:XXX", function(track) {
alert(track.data.availableForPlayback);
});
If you run the code above, you should get a True/False that does what you're after.
Unfortunately not, not at this time. The linking is actually done by the client itself rather than any of our backend services, so none of our APIs have this information.

Resources