I have been trying to create a bundle of cards in https://developers.google.com/glass/tools-downloads/playground without success, here is what I did:
insert a card with the following json:
{
"text": "Cover",
"bundleId": "123",
"isBundleCover": true,
"notification": {
"level": "DEFAULT"
}
}
then insert a 2nd card with the following json:
{
"text": "Card 1","bundleId": "123","notification": {
"level": "DEFAULT"
}
}
But they don't appear to be threaded in my timeline under playground. What did I do wrong? Thanks in advance!
From the usage information at https://developers.google.com/glass/tools-downloads/playground
Note: The Playground does not support bundles.
Your card json looks to be correct though, so it should show up correctly on Glass.
Related
Background: I am working through a flashcard Skill that enables Alexa to ask basic questions about a programming language. The user can choose between Ruby, Python or JS.
The progression goes:
LaunchRequest welcomes the user, then asks for their language preference
User responds, causing SetLanguageIntent to trigger
A question is then asked of the user
However, I am unable to get past the SetLanguageIntent without encountering "There was a problem with the requested skill's response".
Here is the dialogue:
As one can see from the response, SetLanguageIntent is activated properly with the slot ruby also matching correctly.
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.743f750e-96d9-4ef9-aeba-e0aec2e45afb",
"timestamp": "2018-09-12T13:35:25Z",
"locale": "en-US",
"intent": {
"name": "SetMyLanguageIntent",
"confirmationStatus": "NONE",
"slots": {
"language": {
"name": "language",
"value": "ruby",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.ee34487d-d343-4deb-ab6c-193777c92aa8.languages",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "ruby",
"id": "58e53d1324eef6265fdb97b08ed9aadf"
}
}
]
}
]
},
"confirmationStatus": "NONE"
}
}
}
However, at this point the error message "There was a problem with the requested skill's response" always appears. There are no errors reported on CloudWatch Logs.
For reference, here is the SetLanguageIntent code. As noted in the comment, the test "Okay" should at least have been said. However, it does not get executed.
'SetMyLanguageIntent': function() {
this.response.speak('Okay'); //this should at least have been said
this.attributes.flashcards.currentLanguage = this.event.request.intent.slots.languages.value;
var currentLanguage = this.attributes.flashcards.currentLanguage
this.response
.speak('Okay, I will ask you some questions about ' +
currentLanguage + '. Here is your first question. ' +
AskQuestion(this.attributes))
.listen(AskQuestion(this.attributes));
this.emit(':responseReady');
},
Any help is much appreciated!
Edit: updated with slot names
I see a problem with your code. This is why you're probably having an issue. You are trying to access an undefined property this.event.request.intent.slots.languages.value. The mistake is word languages. It should be language.
So the way to acces a slot value should be:
this.event.request.intent.slots.language.value
I fixed the same problem for myself by simply adding a cardRenderer() to my response. Like this:
this.response.speak("my text").cardRenderer("ttitle","some content","image");
In the test simulator's device log, I noticed the card renderer show up, saying the skill responded with a failure. So I took a shot and it worked. Hopefully this fixes it for you too!
I have developed an app and it is functioning properly, however when it comes to designing, i am unable to achieve what is given in the example despite of doing the same code in the example. I want to achieve this design where image is in the center with title above and description down but what I am getting is this, side image, side title and description down. Please let me know how to achieve that. Here is my sample of my code
"response" : {
"outputSpeech" : {
"type" : "SSML",
"ssml" : "<speak>Hello,welcome!</speak>"
},
"card": {
"type": "Standard",
"title": "My Title",
"text": "My description",
"image": {
"smallImageUrl": "small image with the width 720 and height 480",
"largeImageUrl": "large image with the width 1200 and height=800"
}
},
"reprompt": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>I am waiting for your command!!</speak>"
}
},
"shouldEndSession" : false
}
It looks like Amazon has changed the Standard Card layout. Images are now shrinked and pushed to the left. The examples shown in current documentation on Cards have the new layout. The blog post you are referring is more than one and half years old
I got the error code Error code: InvalidIntentSamplePhraseSlot when I built the model using the new skills console.
The full error message is
Sample utterance "AddBookmarkIntent i am at {pageno} of {mybook}" in intent "AddBookmarkIntent" cannot include both a phrase slot and another intent slot. Error code: InvalidIntentSamplePhraseSlot -
where {pageno} is AMAZON.NUMBER and {mybook} is AMAZON.SearchQuery
What is the error about and how can I solve it?
edit: add the JSON for the intent
{
"name": "AddBookmarkIntent",
"slots": [
{
"name": "mybook",
"type": "AMAZON.SearchQuery"
},
{
"name": "pageno",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"i am at {pageno} of the book {mybook}",
"save page {pageno} to the book {mybook}",
"save page {pageno} to {mybook}",
"i am at {pageno} of {mybook}"
]
}
It's not allowed to have a slot of the type AMAZON.SearchQuery in the same Utterance with another slot, in your case AMAZON.NUMBER.
Mark one of the slots as required and ask for them separately.
A little example:
Create the Intent put in the utterances and slots:
"intents": [
{
"name": "AddBookmarkIntent",
"samples": [
"I am at {pageno}"
],
"slots": [
{
"name": "mybook",
"type": "AMAZON.SearchQuery",
"samples": [
"For {mybook}"
]
},
{
"name": "pageno",
"type": "AMAZON.NUMBER"
}
]
}
Mark the specific slot as required so Alexa will automatically ask for it:
"dialog": {
"intents": [
{
"name": "AddBookmarkIntent",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "mybook",
"type": "AMAZON.SearchQuery",
"elicitationRequired": true,
"confirmationRequired": false,
"prompts": {
"elicitation": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook"
}
}
]
}
]
}
and create the prompts to ask for the slot:
"prompts": [
{
"id": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook",
"variations": [
{
"type": "PlainText",
"value": "For which book you like to save the page?"
}
]
}
]
This is probably much easier with the skill builder BETA and not its editor because it will automatically create the JSON in the background.
The error is telling you that you have an Intent name in your Sample Utterance where it should only have Slots and it looks like you do.
"AddBookmarkIntent i am at {pageno} of {mybook}"
"AddBookmarkIntent" shouldn't actually be inside of the utterance. So turn your utterance into:
"i am at {pageno} of {mybook}"
I know that some of the documents show an example of the sample utterances with the Intent Name first, such as here. But that has a big warning near the top:
So you have to be careful about which documents you read and follow based on which way you are building your Alexa Skill.
Follow this if you are using the Skill Builder.
It unfortunately seems like an utterance can only reference 1 "Phrase" slot type.
For your specific case, it does look like there is now a non-phrase slot type AMAZON.Book in public beta; if you use that instead of AMAZON.SearchQuery it might work?
Src: https://developer.amazon.com/en-US/docs/alexa/custom-skills/slot-type-reference.html
In Watson Conversation when I create a dialog, can I list the values of my Entity?? for sample I have one entity fruits (apple, orange, and etc) so in one of my responses can I list the content of #fruits??
tks
For access intents and entities, first, your user need to request something for calling this objects... And in this case, your application will access:
Name of entity (#fruits);
The value of your entity typed from your user
Your app will show Fruit:orange if you user type orange, and Watson will recognize the entity and the value and save inside entities.fruit[0], not all values from your entity inside #fruits, like this.
Access entity: IBM Official Documentation.
Anyway: I think you want all values. Right?
I guess that best form is using context variables to save all "fruits" and show like:
For this Dialog runtime context:
{
"context": {
"toppings_array": ["orange", "apple"]
}
}
Update:
{
"context": {
"toppings_array": "<? $toppings_array.append('banana', 'melon') ?>"
}
}
Result:
{
"context": {
"toppings_array": ["orange", "apple", "banana", "melon"]
}
}
Show for the user:
{
"output": {
"text": "This is the array: <? $toppings_array.join(', ') ?>"
}
}
All JSON Example:
{
"context": {
"fruits": [
"lemon",
"orange",
"apple"
]
},
"output": {
"text": {
"values": [
"This is the array: <? $fruits.join(', ') ?>"
],
"selection_policy": "sequential"
}
}
}
Result:
This is the array: lemon, orange, apple
See the official example from Official Documentation.
In official documentation of quick replies says:
Quick Replies work with all message types including text message, image and template attachments.
But when i try send it with template_type: button, I got error:
{
"error": {
"message": "(#100) Only one of text or attachment can be specified",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "H8w+ZfRbBub"
}
}
That I try to send:
{
"recipient": {"id": "234567890"},
"message": {
"text": "TEXT_MESSAGE",
"quick_replies": [
{
"content_type": "text",
"title": "SOME_TITLE_1",
"payload": "PAY_LOAD_1"
},
{
"content_type": "text",
"title": "SOME_TITLE_2",
"payload": "PAY_LOAD_2"
}
],
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "TEXT_MESSAGE",
"buttons": [
{
"title": "READ_MORE_BUTTON",
"type": "postback",
"payload": "look:1:c"
}
]
}
}
}
}
when I sent without message.text, I got error:
{
"error": {
"message": "(#100) Cannot use both CTA and quick reply",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "C0DDxGzaUUj"
}
}
What is CTA?
How send quick replies with attachment?
This message structure should work for sending an image attachment with quick replies:
{
"recipient": {
"id": recipient_id
},
"message": {
"attachment":{
"type":"image",
"payload":{
"url": image_url
}
},
"quick_replies": [
{
"content_type":"text",
"title": "Next Image",
"payload": "YOUR_DEFINED_PAYLOAD_FOR_NEXT_IMAGE"
}
]
}
}
Hope that helps dmitry.
try this way. It will insert both buttons and quick replies but button will be at top and quick replies will be at the bottom
"message":{
"quick_replies":[
{"content_type":"text",
"title":"title1",
"payload":"SUPPLEMENT_1"},
{"content_type":"text",
"title":"title2",
"payload":"PAYLOAD_1"
}
],
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"your text",
"buttons":[
{
"type":"postback",
"title":"Confirm",
"payload":"USER_DEFINED_PAYLOAD"
}
]
}
}
}
So, I've got your same problem and I did some searches around.
What does CTA stands for?
First of all, CTA stands for Call-To-Action. These are the buttons you create with a request for a Button Template, Generic Template or with the Persistent Menu Thread Settings.
It seems that, although as you said FB official documentation explicitly states that Quick Replies are supported with ANY template, for some reason this doesn't include the Button template.
Why is that?
It seems logical to me that the Button Template should be used to present the user with a choice, same thing that the Quick Replies do, so it would be redundant.
Why is that not documented?
I'm assuming that it's probably due to the fact that the Messenger Platform API is still in beta and there are lots of changes from day to day. Personally, I'm working on a Java framework for doing Facebook Messenger bots and I'm finding that many things are not very well documented and often the error messages you get back are misleading. So, you should probably accept the fact that the Button Template and Quick Replies doesn't work together. Quick Replies works with any other template or with text messages though.
This worked for me while using dialogflow
{
"facebook": {
"attachment":{
"type":"template",
"payload":{
"template_type":"generic",
"elements":[
{
"title":"Welcome!",
"image_url":"https://petersfancybrownhats.com/company_image.png",
"subtitle":"We have the right hat for everyone.",
"default_action": {
"type": "web_url",
"url": "https://petersfancybrownhats.com/view?item=103",
"webview_height_ratio": "tall"
},
"buttons":[
{
"type":"web_url",
"url":"https://petersfancybrownhats.com",
"title":"View Website"
},{
"type":"postback",
"title":"Start Chatting",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
]
}
},
"quick_replies":[
{
"content_type":"text",
"title":"Search",
"payload":"<POSTBACK_PAYLOAD>",
"image_url":"http://example.com/img/red.png"
},
{
"content_type":"location"
}
]
}
}