add confirmation entity in dialogflow (api.ai) - api-ai

I need to add a confirmation entity so I get a 'Yes' or a 'Cancel' in the parameters of a certain operation in dialogflow (api.ai).
Say a user is purchasing a coffee, I'd ask details about the coffee and the quantity and finally i need a confirmation, what entity should i apply for that? any tutorial that refers to the same will also be helpful.

DialogFlow has a concept called a follow-up intent that you could use in a case like this:
You would create a "yes" follow-up to capture if the user wants to proceed, a "no" to cancel, and a "fallback" to explain to the user what is happening and what are acceptable answers.
If you are working with Actions on Google, you could also use askForConfirmation which is done completely from within your webhook code.
You can choose the most appropriate way depending on how your code is structured.

The other way would be to create a confirmation entity and prompt for it in your intent.
Create entty: Create 2 rows, one for yes and another for no, with the appropriate synonyms.
Adding it as a parameter with the entity you just created, and add the appropriate prompt.

An answer for who jump here trying to obtain this confirmation behavior with Actions on Google.
You can take a look at the documentation for Confirmation helper of Actions SDK for Node.js.
The solution is to setup an intent with the actions_intent_CONFIRMATION event in DialogFlow in order to retrieve the user response. My advice is to check how you configured your intents and use this method, otherwise be sure to create the follow-up intents with the desired context lifespan.
Example from documentation:
app.intent('Default Welcome Intent', conv => {
conv.ask(new Confirmation('Are you sure you want to do that?'))
})
// Create a Dialogflow intent with the `actions_intent_CONFIRMATION` event
app.intent('Get Confirmation', (conv, input, confirmation) => {
if (confirmation) {
conv.close(`Great! I'm glad you want to do it!`)
} else {
conv.close(`That's okay. Let's not do it now.`)
}
})
See also this question.

Related

Zapier - Zap, How to call an Action on a list one by one

I'm configuring a zap which does the following:
Get a list of emails from an API endpoint.
Subscribe each record to Mailchimp
My problem here is that the subscriber email takes in a list of emails and this returns the following error message:
Bargle. We hit an error creating a subscriber. :-( Error: Invalid
Resource - Please provide a valid email address.
This is because Mailchimp aparently doesn't allow multple subscriptions in one single form.
So my question is, is there a way to perform an action per element in the list ?
Some sort of
emailList.foreach(function(email){
performAction(email);
})
Note that I cannot use the cli, is this possible with some sort of funnel action in zapier or maybe using the scrpting ?
Thanks
David here, from the Zapier Platform team.
By default, when a trigger returns a top-level list of objects, subsequent actions occur for each. I'm not sure what type of trigger you're working with, but make sure it returns an object like this:
return [{email: 'email1#gmail.com'}, {email: 'email2#gmail.com'}, {email: 'email3#gmail.com'}]
and it should work as expected.

Implementing login for specific users in iOS

I'm creating an app and currently working on the login/sign-up. I found this tutorial (http://www.appcoda.com/login-signup-parse-swift/) but I was wondering if there were a way to accept only certain email addresses? Some pseudocode would be
//Confirm email address if it includes "#collge.KSU.edu"
//saves user info
Well you kind of just answered your question but I guess something like:
Get username from user (or email or whatever)
if(username is valid) {
move to different screen or show notification
}
else {
display pop-up instructing the user their input is not valid
}
The main part is just parsing the String and making sure it is valid which I believe switch is already equip with. So for the case of a specific email, you could try value.contains("#collge.KSU.edu"), of course you'll have to be a bit more careful with using that to make sure they put it in the right spot.

Parse and Swift: How use advance targeting push to specific devices without users?

I currently creating an app where the users can add a posting without logging into the app or using any credentials.
Other users of the app can open the app and directly comment on the posts(the comments are an array of the post object).
I read the parse docs and I believe that this will use advance targeting. I saw PFInstallation.currentInstallation() for advanced targeting but I believe that is based on the users class and I am not using the Parse.com users class
What I would like to do is to send a push notification to the original poster when a comment is added to their post... So, I was wondering how I would go completing that?
Thanks!
It couldn't be easier,
Installation has a "user" column. Just make a query that matches the "user" of interest. So, your code will look something like this....
if ( .. comment made, need to send a push .. )
{
console.log(">>> 'comment' was added....");
var query = new Parse.Query(Parse.Installation);
query.equalTo('user', .. whoWroteThePost .. );
alert = "Wow! You have a new comment on a post you wrote!!!";
Parse.Push.send(
{
where:query,
data:{ alert: alert, badge: "Increment" }
});
return;
}
Note that you said ...
"What I would like to do is to send a push notification to the original poster when a comment is added to their post... "
In that sentence you speak of the "original poster". So, that's going to be a variable like originalPoster. So this line of code
query.equalTo('user', .. whoWroteThePost .. );
will be
query.equalTo('user', originalPoster );
Note that this is extremely common, and you can find endless examples on the web! Here's just one: example
Note that:
Parse's term "advanced targeting" is very confusing.
To phrase the same thought another way,
Parse's 'channels' are just silly, ignore them.
That is to say, simply ignore the "channels" nonsense, and just search on users. It's easier and less confusing than the channels business, which is just an extra field you have to fill-out al the time.
It's just one of those weird things about Parse.
I've never used the "non-advanced targeting" - it's stupid and pointless. And the "advanced" targeting is trivial to use: assuming you can write cloud code at all you can do "advanced" targeting. If you can write a query in cloud code, you can do "advanced" targeting.
Essentially,
query.equalTo('user', .. whoWroteThePost .. );
Note that, of course, you may have to first look up who wrote the post, and then from there you can make the query for the Push.
Note, in this process it makes:
no difference at all if the user is anonymous.
You can and should go ahead and send pushes, in the same way.
Advanced targeting is not done against users. It's just that is the easiest way to show an example.
You need to store the installation against the objects you want to push to. So in this case store the installation against the post. Then when the comment comes in you can send a notification to the installation connected to the post it relates to.
I think you are looking something called anonymous users. There is almost impossible to send notification without user's data. But, Parse.com provides something called anonymous users so that app users are not necessary to sign up in order to fully function something user related operations.
Then, you will need to store some information in order to find the target.
Parse.com Anonymous Users

Umbraco contour get email from workflow

I have a receipt page that the user is redirected to after form submisson.
On this page I show a macro that summarise the form.
The gist of the macro is pretty much like this:
http://our.umbraco.org/forum/umbraco-pro/contour/32623-Sort-and-iterate-through-form-fields-with-Razor
I would like to tell the user "you will soon receive an email" if a workflow exists, that sends an email to the submitter, on the page.
How is this feasable?
I have searched a lot on the internets and can only see how I create my own workflow, not how I access workflows by code...
Ok, so I posted on our.umbraco and got an answer:
http://our.umbraco.org/forum/umbraco-pro/contour/47728-Umbraco-contour-get-email-from-workflow
For your ease of access I paste the answer here:
You'll need to make use of
Umbraco.Forms.Data.Storage.WorkflowStorage
Once you create an object of that instance you can call the method GetAllWorkFlows(Form form) or GetActiveWorkFlows(Form form, FormState state)
You'll of course need the form object
And you can get that with
Umbraco.Forms.Data.Storage.FormStorage

symfony 1.4: two questions about sfDoctrineApplyPlugin (well, could be also considered as general questions)

I have found in sfDoctrineApplyPlugin a template called applyAfter.php
that shows a message like "You have registered ok..." after the users apply for an account. It is called from the sfApply/apply action this way: "return 'After';" when the apply form is valid.
What kind of template is that? I never saw that way (return 'After';) of calling a template. Can someone give me info about that?
Second question: I show a layout with a language select when the the
apply form is printed. I wouldn't like to show that language select in
the page that shows the message "You have registered ok...". As the action
is the same in the both pages (sfApply/apply), what should i do to hide
the language select in the verification page?
Javi
The function returns the string 'After' to the caller. The caller always seems to be as follows: $this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]');
So, the string 'After' is being used in conjunction with the setNameFormat function (which is part of the symfony libraries). All it is doing, is setting the 'name' attribute for the form. More information on this function here.
For your second question, you could simply add an IF statement, to check to see if the current route is the one that you do not want to display the language select on. If it isn't, then display the language select.
You can verify the current route with the following code:
sfContext::getInstance()->getRouting()->getCurrentRouteName();

Resources