Alexa custom skill not giving answers to the default queries - alexa

I have created a custom skill for Alexa. I can able to get the response for custom skills also. But I'm getting one issue.
I have created a simple skill with invocation FullName and intent FullNameIntent which has the utterance like What is my full name, then it's returning my full name. But next query, if I'm asking what is the time now, it's giving answers again full name only.
My expected answer is current time as response.

You will have to create separate intent and sample utterances for 'what is the time now'. As you didn't mention anything about the intent for the time I believe you don't have an intent and sample utterance for the same.

Related

Accept any user input for Alexa Custom Skill, but include only part of that input in confirmation

I'm trying to build a custom Alexa skill for a gratitude diary. The goal is to have an interaction in which the Alexa device asks the user what they're grateful for, and repeats it back as confirmation.
I'm encountering a problem when it comes to repeating back what the user has said. I'd like the conversation to go like this:
Alexa: What are you grateful for today?
User I'm grateful for dogs
Alexa: You said you're grateful for dogs. Is that correct?
I've set this up as a single intent, as follows:
gratitude_object as a required slot, of type AMAZON.SearchQuery
user utterances for this slot are I'm grateful for {gratitude_object} (and a few variations)
confirmation message for this slot is You're feeling grateful for {gratitude_object}. Is that correct?
The problem I'm encountering is that when I test this model in the Utterance Profiler, it goes like this:
Alexa: What are you grateful for today?
User I'm grateful for dogs
Alexa: You said you're grateful for I'm grateful for dogs. Is that correct?
I'm guessing this is something to do with the fact that AMAZON.SearchQuery will accept anything as valid input, but I'm not sure how to go about resolving this.
I've also tried creating a custom slot for the I'm grateful for phrase:
slot name: gratitude_phrase_initiator
slot type: custom slot type
slot values: "I'm grateful for", "I am grateful for" (etc)
However, if I then try to use this slot in my intent, by making the user utterance for the gratitude_object slot:
{gratitude_phrase_initiator} {gratitude_object}
...then I get the following error:
Sample utterance "{gratitude_statement_initiator} {gratitude_object}" for slot "gratitude_object" in intent "NewEntryIntent" cannot include both a phrase slot and another intent slot. Error code: InvalidSlotSamplePhraseSlot
.
I'd really like to keep the interaction as it is currently, with the user starting by saying "I'm grateful for...". Any suggestions for how I could make this work using the interaction model, or is it just impossible? Is this something I could handle in the code instead of the interaction model?
Looks like you set it up perfectly but you would expect SearchQuery to do a better job of excluding the initial utterance phrase. So you'll have to parse it some more in code. You should use a Lambda Function to string replace the slot value to remove any initial phrases.
Example in Node.js:
var gratitude_object = this.event.request.intent.slots.gratitude_object.value;
var initial_phrases = [
"i'm grateful for",
"i am grateful for",
];
initial_phrases.forEach(function(value){
gratitude_object = gratitude_object.toLowerCase().replace(value,"");
});
Notice the array of intitial phrases are written in lowercase and the forEach loop also makes the slot value lowercase before checking to replace. That way you don't have to worry about case matching when writing the initial phrases you want to remove.

Alexa getting response from user after prompt

So we are setting up a system in which a user can set reminders. Currently my intent is set up to provide a Day and a Time. If I say something like set reminder for next tuesday at 9pm, in my intent I see the values coming in fine. The issue is if let's say they say something like set reminder for next tuesday, they gave us the day but not time. So in my intent, I have this response:
else if(obj.Day.value && !obj.Time.value) {
this.response.speak(`Looks like you requested a reminder on ${obj.Day.value}, what time would you like the reminder set for?`).listen('Thanks');
console.log(JSON.stringify(this.response, null, 2));
this.emit(':responseReady');
}
The issue I am having is... how do I get what they said? I've also tried this.emit(':ask', '...') but I still don't see what they actually say.
I'm sorry if this is confusing, essentially this is a simplified question.
How do we get the response from the user (for missing information) after Alexa asks something in an intent?
For this, you will want to use the elicitSlot Directive. Docs found here.
Try:
this.emit(':elicitSlot','slotName','intentName');
Alexa will know that you want to fill the next user's response to the Time slot, if you put "Time" into the slotName property above.
In the Alexa Console, you can specify how Alexa should elicit that slot. You can even provide multiple ways of asking and Alexa will choose one.

Watson Dialog does not recognize continuation of conversation

When trying to use the Dialog tool to get a feel for how the APIs work, I ran into a problem where a POST to /conversation creates a new conversation, instead of continuing an existing one. I am using the docs found at : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/dialog/api/v1/
An initial POST returns a conversation and client id, but subsequent requests with those values added, along with an input value, just return information for a new conversation. Are these docs inaccurate?
Here is a screenshot from one of my many attempts at getting this to work. The client and connection IDs are from a previous POST to /conversation
http://imgur.com/4035dWe
Thanks for your help!
Your first call to Converse you should not specify the conversation ID. Dialog will return a conversation ID with the first response.
You then use that ID going forward to maintain the conversation. It is unclear if you are doing this in the example above.
It turns out I was using the incorrect encoding for the conversation / client ID's and input. Watson expects the form values to be URL encoded. Once I made that change, the problem was resolved.
Thanks to everyone who offered their time and help!

Outputting Stripe plan name via plan-ID using AngularJS ng-model two-way data binding

I am outputting form inputs on the final page of a checkout field, titled "Review & checkout"... on this page I display the plan the customer picked and the personal info they provided so far.
I have no problem showing fields like Name or Email, as the value inputted is being shown, as Angular displays whatever was in the value="" field of the input.
To display the subscription plan that the customer picked, it's trickier.
The value field is already being utilized to tell stripe which plan the customer should be charged for.
How can I get around this problem?
I am able to display the stripe-id for the plan but it is not user-friendly. They are id's like trad-2-5, trad-2-6, trad-2-7... so what I want to do is display a custom title when trad-2-5 is selected, and so on...
Any help is greatly appreciated!!Thanks
There are a couple of ways you could do this.
The really silly answer is that you can just create a map of plan ids to human-readable descriptions in the Angular controller code, then display that. This might be enough for what you want, but it's also pretty hacky, and not a lot of fun to maintain.
The less silly answer depends on where these plan ids are coming from. If they are coming from an endpoint on your server, which gets them from Stripe's plans endpoint, then you could also pass along the display name of the plan from that endpoint. If the plan id's are hard coded somewhere, or whitelisted, then this may not make sense. However, that display name is what will appear on the customer's invoice, and credit card statement, so it'd be nice to make it match up with what they see on the checkout page.

Drupal Replacement Pattern for Entity Reference

I have a Profile Type attached to a user. In there I have a Entity Reference Field of Program Manager. I have Live Events(content-type) that people can register for. I set up a Rule to Email the Program Manager every time someone registers.
My problem is I am trying to pull information from the Profile based on the the entity reference for the Program Manager.
I have the field printing out by using this pattern...
[registration:entity:field_program_manager]
However when I try to pull the first name, email of phone I can not get it to show up.
Does anyone have any ideas to share?
Many Thanks!
Okay so I was trying to solve for sending the email to the Author of the page but was having issues. So I created a new fields hoping it would be easier. In trying to solve for this I solved the original issue.
To print the Author of a node to an email through Rules actions us this.
[registration:entity:author]
So for first name it would be:
[registration:entity:author:profile-main:field_first_name]
Hope it helps someone else.
If you're using entityform instead of a node and referencing the default user info (not the 'Main Profile' profile type), then you want to use something like
[entityform:field-staff-entity-ref:field-work-email]
In this case, 'field-staff-entity-ref' is the entity reference field in the entityform and 'field-work-email' is the field in the user's account settings.

Resources