Hi My intent schema is like this:
{
"intents": [
{
"slots": [
{
"name": "Literalslot",
"type": "AMAZON.LITERAL"
}
],
"intent": "ConverseGenieIntent"
},
{
"intent": "AMAZON.HelpIntent"
},
{
"intent": "AMAZON.StopIntent"
},
{
"intent": "AMAZON.CancelIntent"
}
]
}
And my utterances are:
ConverseGenieIntent {hello|Literalslot}
ConverseGenieIntent {validate payroll|Literalslot}
ConverseGenieIntent {no no|Literalslot}
ConverseGenieIntent {no|Literalslot}
ConverseGenieIntent {no its not correct|Literalslot}
ConverseGenieIntent {no my payroll id is |Literalslot}
ConverseGenieIntent {its not correct|Literalslot}
ConverseGenieIntent {its wrong|Literalslot}
ConverseGenieIntent {no|Literalslot}
ConverseGenieIntent {that's not correct|Literalslot}
ConverseGenieIntent {that is not correct|Literalslot}
ConverseGenieIntent {hi yeah|Literalslot}
ConverseGenieIntent {what is your name|Literalslot}
ConverseGenieIntent {may i know your name please|Literalslot}
ConverseGenieIntent {hey what is your name|Literalslot}
My skill is actually a bot which gives multiple conversations.
Expected converstion:
User: Alexa ask genie to say hello.
Alexa: Welcome to genie.
User: Start session..
Alexa: Please tell me the store number?
User: one two three four
Alexa: Are you calling from BRAYBOOK 1234?
User: Yes
Alexa: Please tell me payroll ID?
User: 5678
(....and continues for at least three more conversations)
But while testing in Echo:
User: Alexa ask genie to say hello.
Alexa: Welcome to genie. Please tell me the store number?
User: one two three four
Alexa: Sorry i couldn't find that
.....ALWAYS THE CONVERSATION STOPS HERE....... I really don't know why... I don't wanna use dialog directives as the response from the lambda function comes from a DialogFlow bot.
I tested the skill in service simulator the skill is working fine!!! This problem happens only why i test my skill in Echo.
AMAZON.LITERAL takes one literal at a time. You can only say one or two or three ... at a time. Plus, if you want a group of literal to do further processing, then you have to use State Management to receive the input one by one.
Proposed Conversation
Alexa: Please tell me the store number?
User: one
Alexa: Next Number?
User: two
Alexa: Next Number?
User: three
Hey it not actually like that. Your answer is wrong. I don't have to give input as "One" then "two" and after it asks "three" ....No not like that. Inputs like "1234" can be given as it worked well in Echo device. Never test your skill in Echosim.io. Always test in an Amazon device.
Related
I'm relatively new to Firebase and I'm trying to figure out the best way to structure my DB for 1:1 chats.
It basically has to function like Whatsapp - you have your active conversations on the left when a person sends a message that conversation is then put on top of the list and a basic one-on-one chat on the right.
Right now the best that I have got is to create a firestore "chats" collection
chats : {
chat : { users : [user_id, user_id], messages : {user_id, message, created_at} created_at }
}
Would this solution allow me to :
Get all the chats based on the logged-in user?
Then Sort the returned chats by date?
Get the latest message from the messages collection for each returned chat?
On new message change the order of the chat and update the latest message?
And if all of that is doable would this be effective or is a there a better way?
Any help would be appreciated - thanks!
How would a logged in user be associated with any given chat they participated into?
Right now your structure doesn't seem to allow for an easy handling of this, given that "user_id" are nested within the chat document.
Personally, here's what I would do.
First I would create 2 collections, one called chats one called users.
users would have the following structure:
{"users": {
"userID_1": {
"name": "John",
"surname": "Smith",
"chats": [
"chatID_1",
"chatID_2",
"chatID_3"
]
},
"userID_2": {
"name": "Betty",
"surname": "Sue",
"chats": [
"chatID_1",
"chatID_4"
]
}
}}
Chats would instead be stored like this:
{"chats": {
"chatID_1": {
"chatName": "foo",
"otherInfo": "..",
"messages": {
"messageID_1": {"senderID": "..", "message": "..", "timestamp": 999},
"messageID_2": {"senderID": "..", "message": "..", "timestamp": 999}
}
},
"chatID_2": {
"chatName": "bar",
"otherInfo": "..",
"messages": {
...
}
}
}}
This way, when a user is logged in, you can easily fetch all his chats by querying users.userID.chats, and retrieve the content of any selected chat by querying chats.chatID.messages.
My Watson Conversation bots typically have a node where I load some data into context. This usually contains all possible answers, strings, various other data.
So one of my first nodes in any bot looks like this:
{
"type": "standard",
"title": "Load Messages",
"output": {
"text": {
"values": [
""
],
"selection_policy": "sequential"
}
},
"context": {
// A whole bunch of data here
}
...
Is there a limit on how much data I can put there? Currently I have around 70 kilobytes, but potentially I can put a few megabytes there just for the convenience of running the logic inside Conversation. (Yes I am aware that this entire data will be sent back to the client, which is not very efficient)
There is no documented limit. You are more likely to hit network issues before Watson Assistant has any issues.
But storing your whole applications logic in the context object is considered an anti-pattern.
Your context object should only store what is required in Watson Assistant, and then if possible only for the related portion of the conversation.
For one time context values you can store them in the output object.
{
"context": {
},
"output": {
...
"one_time_var": "abc"
}
}
This will be discarded on your next call.
If you have a large volume of data that could be used at different times, then one pattern to use is a context request object.
For example:
"context": {
"request": "name,address,id"
}
Your next response from the application layer would send this:
"context": {
"name" : "Bob",
"address": "123 street",
"id": "1234"
}
You have your returning response update those variables, then clear the context variables again. If you have other context variables that need to stay, then store those in an object and erase just that object.
I'm writing an Alexa skill that captures a ticket number from one intent and captures age from different intent. and Basically, these two are of type number.
When I'm trying to enter a number, it is being captured in the first Intent's slot. Here is my intent schema.
{
"intents": [
{
"slots": [
{
"name": "TicketNumber",
"type": "AMAZON.NUMBER"
}
],
"intent": "CheckStatusIntent"
},
{
"slots": [
{
"name": "ageAndCurrency",
"type": "AMAZON.NUMBER"
}
],
"intent": "ClientSuggestIntent"
}
]
}
and my sample utterances are
CheckStatusIntent I want to check on the status of a ticket
CheckStatusIntent {TicketNumber}
ClientSuggestIntent I have a client meeting tomorrow.
ClientSuggestIntent {ageAndCurrency}
ClientSuggestIntent {personName}
In my ClientSuggestIntent, the flow should be as below.
User: I have a client meeting tomorrow.
Alexa: What is the Client's name.
User: Sara John
Alexa: What is Sara John's age
User: 65
Here when I give 65, instead of matching with in the ClientSuggestIntent, it is matching with the TicketNumber of CheckStatusIntent.
This is very confusing, please let me know where am I going wrong and how can I fix this.
Thanks
You need to use "state handlers" do do this. Here is a video I did that explains how to do it. https://youtu.be/ukR0Aw5P3W8.
If you're using the ask-sdk for node you'd use Alexa.CreateStateHandler(...) to create one state handler with your CheckStatusIntent function in it and another state handler with your ClientSuggestIntent function.
Also read https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#making-skill-state-management-simpler
To elaborate a bit on Steve's answer above, the problem is that Alexa cannot tell the difference between "CheckStatusIntent {TicketNumber}" and "ClientSuggestIntent {ageAndCurrency}" since both are just a number.
You need to either give Alexa a way to differentiate between each of your intents. For example, "ticket {TicketNumber}" and "my age is {age}".
Or alternatively, you can setup a context as described by Steve, and use a single intent to handle either/any number-only input.
I hope this helps clarify things. I know its complicated when your just getting started. I found it easiest to keep things very simple using multiple, unique intents.
I am writing a custom skill for the amazon echo and I need to get a unique device id so I can register then product to my service. Everything I read says that you cannot get the id from the device. Has amazon changed this? Is there a work around to get a device id?
This week Amazon added the Device ID (unique) to the LaunchRequest JSON payload in Alexa Skills.
{
"session": {
"new": true,
"sessionId": "string",
"application": {
"applicationId": "string"
},
},
"context": {
"device": {
"deviceId": "string",
},
"request": {}
}
You can use the context->device->deviceId string to uniquely identify the device from which the request came.
Read more # https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#request-body-syntax
There is no way to get a unique device ID. All you can do is get a unique User ID. There is no known workaround.
If you're looking for how to get Alexa Device ID?
Use the below snippet, It will work like a charm.
device_id = handler_input.request_envelope.context.system.device.device_id
I hope this helps you.
I've tried
https://api.linkedin.com/v1/people/~/connections:(id,first-name,last-name,phone-numbers)
but it's only get (id,first-name,last-name)
even this:
http://api.linkedin.com/v1/people/id=UserId:(phone-numbers)
Does LinkedIn expose this field ? I've google it, but not found somewhere ..
Linkedin Not provide phone numbers of connections. They only provide basic profile of connections.
check here https://developer.linkedin.com/documents/connections-api
LinkedIn will provide the phone number if the user authorizes r_contactinfo
Sample Request URL:
https://api.linkedin.com/v1/people/~:(id,phone-numbers)?format=json
Sample JSON Response:
{
"id": "ye3i9-_24l",
"phoneNumbers": {
"_total": 1,
"values": [
{
"phoneNumber": "89xx189198",
"phoneType": "mobile"
}
]
}
}
LinkedIn not provide phone number. Check this document for accessible fields of profile
Basic Profile Fields