Pandorabots Initial Bot Message - aiml

In "Chat Widget" for website I can write "Initial Bot Message" but it's not clear how to create in AIML file reaction for the visitor's response to this Initial Message.
As an example I added in "Initial Bot Message" the question "Would you like to see live samples?"
It's implied that there are two possible responses - "yes" or "no".
But the code:
<category>
<pattern>YES</pattern>
<that>WOULD YOU LIKE TO SEE LIVE SAMPLES</that>
<template>Answer YES</template>
</category>
<category>
<pattern>NO</pattern>
<that>WOULD YOU LIKE TO SEE LIVE SAMPLES</that>
<template>Answer NO</template>
</category>
doesn't work.
How to make the bot could react on the responses?
Is it possible to initiate "Initial Bot Message" from the code? For example I want to create a question with buttons - how to do it?

Yes you can do this. First, you need to create a category that you want your bot to welcome your visitor with. I've made one called "Initial Bot Message" with your welcome message and two buttons.
<category>
<pattern>INITIAL BOT MESSAGE</pattern>
<template>
Would you like to see live samples?
<button>
<text>Yes</text>
<postback>AnswerYES</postback>
</button>
<button>
<text>No</text>
<postback>AnswerNO</postback>
</button>
</template>
</category>
Now you need to amend your chat widget code to replace the conversationOpener part with this:
greetingPattern: "initial bot message",
Now the bot won't say a welcome message, it will call your category and allow you to work with <that> etc

Related

Anchor tag not act properly instead show full string inside cfemail content

I've write a functionality about send email process. Here I've set Mail Server details admin setting. And write a below code for sending email. I can successfully send & receive email to my gmail account. But Here I've added some paragraph with anchor tag value that is click me.
<cfoutput>
<cfmail from="test#gmail.com" to="test#gmail.com" username="myemail#gmail.com" password="mypass" port="587" subject="Chaange title" >
<p> I'm from test link click Me 2! </p>
</cfmail>
</cfoutput>
The issue is in my email not received as a click me as a link. Instead it will display entire html about anchor tag. FYR please refer my email content image.
Note : I've already tried with cfsavecontent too but it's not help me.
Could you any one help on this. Why it's was happen ? Thanks in advance.
Add type="html" to your cfmail tag. That should indicate to the end user's email client that the message should be displayed as an HTML page instead of just plain text.

multiple primefaces messages in templates

The Problem:
My Webapplication is build of multiple fragments and templates. The Header-Template has a "p:messages" to display application wide erros. In Addtion to that i have a Content-Template to display the content / body.
Now i have the following problem: I want to show content valdiation errors (e.g wrong date selected etc.) under the components in the Content-Template. If i send a facesmessage it won't only be displayed in the message part of the content but also in the header:
At the moment there are only two components which are going to be validated:
<p:calendar id="calendar1" value="#{doesn't matter}">
<f:validateRequired></f:validateRequired>
</p:calendar>
<p:calendar id="calendar2" value="#{doesn't matter}">
<p:ajax event="dateSelect" listener="#{onDateSelect}"
partialSubmit="true" update="ContentMessages"/>
</p:calendar>
The messages tags:
<p:messages id="GlobalMessages" showSummary="true" showDetail="false" closable="true" redisplay="false"/>
<p:messages id="ContentMessages" showDetail="true" autoUpdate="true"/>
How i send the FacesMessage:
FacesContext.getCurrentInstance().addMessage(componentClientId,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error:","Error Text"));
What i tried so far:
Use two p:message tags with for="calendar1" and for="calendar2". Still errors in both templates.
Use my "ContentMessages" with a for-tag: for="calendar1 calendar2". Shows errors in the header and not in the content, only if i use a single component id for the for-tag it will show the msg in both templates again.
What i can't do:
Use globalOnly="true".
Set the severity for the header only for info and the content for errors & fatals.
As i cannot see the code of your templates i cannot tell if there's something wrong with them, but there should be no problem with targetable messages in primefaces.
Try to narrow the problem down by removing unnecessary code.
This example works 100%, and each message will only be displayed once.
<h:form id="form">
<p:messages for="somekey" />
<p:messages for="anotherkey" />
<p:commandButton value="Message 1" id="m1" update="form" actionListener="#{playgroundController.addMessage1()}" styleClass="ui-priority-primary" />
<p:commandButton value="Message 2" id="m2" update="form" actionListener="#{playgroundController.addMessage2()}" styleClass="ui-priority-primary" />
</h:form>
Bean:
public void addMessage1() {
FacesContext.getCurrentInstance().addMessage("somekey", new FacesMessage(FacesMessage.SEVERITY_INFO, "Sample info message", "Message 1"));
}
public void addMessage2() {
FacesContext.getCurrentInstance().addMessage("anotherkey", new FacesMessage(FacesMessage.SEVERITY_INFO, "Sample info message 2", "Message 2"));
}

How come the get tag won't display any text in pyAIML?

I am working on a chat bot, just to see how it goes. I am using the PyAIML module. I currently am trying to get the user's name, and be able to use it when asked to. however, when I run the program, it doesn't show the name, only the text surrounding it. pardon my poor explanation of my problem. let me show you some code.
<category>
<pattern>MY NAME IS *</pattern>
<template>ok <star/>, I will do my best to remember that <star/> is your name.</template>
<think><set name = "name"><star/></set></think>
</category>
<category>
<pattern>WHAT IS MY NAME</pattern>
<template>I like to call you <get name = "name"/>. should I change it?
</template>
</category>
when run, the output does not include the name. all it says is:
<--I like to call you . Should I change it?
Am I doing something wrong?
Ps.(please be graceful, I just started AIML today :))
I'm not sure what the "think" tag is for, but I think that the main problem is that you have placed the "set" tag outside of the "template" tag.
Try something like this:
<template>ok <set name = "name"><star/></set>, I will do my best to remember that <get name = "name"/> is your name.</template>

JSF listeners in selectOneMenu

I have a selectOneMenu item with some products. Some of them are unavailable so after you click on it the button "Add" should be disabled and some message should appear that "Sorry the product you chose is currently unavailable". I have no idea how to achieve that. Tried listeners, ajax and still nothing.
This is one of many versions of my JSF Page:
<h:form>
<h:selectOneMenu value="#{productBean.productName}">
<f:selectItems id ="other" value="#{productBean.other}" var="other" itemValue="#{ordersBean.productName}" itemLabel="#{other.name}" />
<f:ajax listener="#{productBean.valueChanged}" />
</h:selectOneMenu>
<h:commandButton value ="Dodaj do zamówienia" rendered="#{productBean.available}"/>
<h:outputLabel id="orderSummary"/>
</h:form>
Beans are rather standard. I just need a clue how to do that and probably I will be able to do it myself.
Thanks in advance.
Here's one of the ways:
In your AJAX listener you could check if a product is available and set up bean field accordingly, or add a message for a component.
Introduce a component in your view that'll hold the message to the user, for example with the #{bean.available ? '' : 'Sorry, out of stock'} value, or enclose it within a <h:panelGroup> and let that component have a rendered attribute, or attach <h:message>/<h:messages> somewhere in your view.
Specify id of the message holder to be rendered within render attribute of <f:ajax> tag.

Like Button (SEND) Shows the og:metadata info and not the href content (sometimes)

The site is: http://grantdeb.com
I want to be able to dynamically add meta properties to the Recommend(s) and Send(s). Right now, it's using the meta og: properties and that is totally NOT what I want.
The LIKE count is also showing incorrectly for each like even though I've pushed the data-href to it like:
<div class="fb-like" data-href="http://grantdeb.com/wedding-photographers-hampton-roads/[dynamic id]/Wedding-Photography" data-send="false" data-width="450" data-show-faces="false" data-action="recommend" ></div>
BUT - for some reason, once in a while the LIKE / SEND does NOT use the meta properties and correctly shows the correct count AND the correct picture / title I want for the Send.
If you go to our site at http://grantdeb.com look specifically at the "Jasmine Plantation Wedding Photography" (like the 5th post down) you'll see the number of Recommendations is correct, and if you hit the "Send" button at right bottom, it actually uses the correct title and picture we want.
That post is the way we want the Recommend / Send to display.
Why is that happening to some of them and to others it shows our og: metadata?
I can’t exactly see on your site what the problem is (or match your problem description with your site’s content) – but looking at the URL for the post you mentioned in Facebook debug tool, it seems that you have
<meta property="og:url" content="http://grantdeb.com" />
set for all of your detail pages – so that is what Facebook considers the “real” URL for all of your actual posts marked with this tag.
(Can’t tell if this is what you explicitly wanted or not, because your problem description is kinda fuzzy to me.)