Windows Live Ag... 的个人资料Windows Live Agents照片日志列表 工具 帮助

日志


1月28日

Wecome Messages and ABGreetingProc

A Welcome Message is the first message an agent displays to the user after the session begins. As such, it deserves special attention.

The Welcome Message serves two purposes:

  1. Introduces the agent
  2. Guides user on next steps

Here's an example:

Hi Tom, I'm SmarterChild!

I'm your new robot friend. I give you conversational access to news, weather, movie times and lots more. I can also play games or just chat!

During the course of our conversations you may see sponsored messages. These messages have the word "sponsorship" at the end. Sponsors help me remain free of cost to you! To learn more about sponsored messages, click here ---> http://web.smarterchild.com/ct?60oTHi/0

I can't wait to show you what I can do, but first I'd like get to know you a little.

May I ask you a few general questions? (To do this later, type "skip." You can also skip any question.)

First, SmarterChild introduces himself and explains what he is, a robot friend that can chat, play games, and provide information. Next he provides an explanation about sponsored messages that appear during the conversation, setting the expectation early on so that users are not surprised to see such messages, and telling them why they appear. Then, he guides the user into a questionnaire.

The example above is the "first message ever" between the agent and the user, so it includes a lot of information. A message like this is the first impression the agent gets to bring users back again and again, and is the best place to explain what it is and what to do continue the conversation.

When the user does come back, we don't necessarily want to show the same lengthy introduction. Rather, the agent should display a "welcome back" message that shows the agent remembers the user, and possibly provides a short reminder of what the agent does and what the next steps are.

Here's an example of a succint "welcome back" message:

Hi, Tom. Nice to see you again. I'm here for all your autos needs. Type "home" to see what you can ask.

The Welcome Message is displayed in the ABGreetingProc procedure. Here's the first half of it:

The FROM_USER_ARRIVES flag is set when the user opens the conversation window. The NEW_USER flag is set when the user has never talked to the agent before. So, this part of the procedure is the "first message ever," and of course the default text should be overridden. You should also consider overridding the DisplaySomeExampleQuestionsEnglish()procedure.

procedure
overrides ABGreetingProc(FROM_USER_ARRIVES, NEW_USER)
  SYS.Matching.ActiveLanguageSet =
"English"
  if NEW_USER
    // Make sure to adapt this if your Agent is not English US (example: call SetCultureCodeToEnglishUK())
    call SetCultureCodeToEnglishUS() // FRHNB: Can't have this in ABStartSessionProc, see bug 2975
    // FRHNB: Temporary workaround bug where an MSN Bot contacts people out of the blue, because an icon information request is mistaken for a user arrives request.
    - Hello UserName(), this is the default first message of the WLA Template. My developer can customize it in /English/Overrides.ddl.
      <blank/>
      Here, s/he can implement an initial interview and ask you questions, for instance what content/locale do you want to use:
    nop
    - MACRO_COMPANY_NAME Australia {Use MACRO_COMPANY_NAME Australia.}
      MACRO_COMPANY_NAME
Canada (English) {Use MACRO_COMPANY_NAME Canada.}
      MACRO_COMPANY_NAME UK {Use MACRO_COMPANY_NAME UK.}
      MACRO_COMPANY_NAME US {Use MACRO_COMPANY_NAME US.}
    nop
    - <blank/>
      You can also display some example questions:
    call DisplaySomeExampleQuestionsEnglish()
    exit all

The other branch of the procedure looks like this, for those users who are not new:

  else
    if !LanguageIsEnglish()
    // Make sure to adapt this if your Agent is not English US (example: call SetCultureCodeToEnglishUK())
    call SetCultureCodeToEnglishUS() // FRHNB: Can't have this in ABStartSessionProc, see bug 2975
    - Hi again, \c
    - Welcome back, \c
    nop
    - UserName(). This is the default first message of the WLA Template. My developer can customize it in /English/Overrides.ddl.
    nop
    if FROM_USER_ARRIVES
      // If the user didn't ask a question yet (event "user arrives" detected), we display a greeting and ask to help.
      - I am ready to help you!
      - How can I help you?
    else
      - <blank/> // just to go to next line

Here we set the culture code if it hasn't been set, and display the "welcome back" message. In addition, if we are displaying the welcome message because the user simply opened the window (FROM_USER_ARRIVES), we append additional text remind the user the agent is ready to go.

1月18日

Simple Presentation Settings

There's no reason to make your agent stick with whatever default style the IM client chooses.  Mix it up a little by changing a few presentation settings.  In particular, the SYS.Presentation variable.
 
Here is an example of setting the SYS.Presentation variable, which is normally done when the session begins :
 
  SYS.Presentation.Encoding.In = "utf8"
  SYS.Presentation.DefaultFontColor = "red"
  SYS.Presentation.DefaultFontFace = "Arial"
  SYS.Presentation.DefaultFontSize = 2
 
This should be pretty self-explanatory, but there are a couple of gotchas.
 
First, in Messenger you can only manipulate the presentation at the message level -- that is, you can't change the color of individual words or lines.
 
Second, changing the font size in Messenger has no effect whatever on what the other person sees in their client.  This applies whether you are a bot or a human :).
 
1月11日

Restricting Users Based on Age

Sometimes an agent’s content and purpose is inappropriate for certain age groups, specifically younger audiences. For example, if your agent markets a brand of beer, you may want to restrict users under 21 from chatting with the agent.

We developed an agent for Match.com (datingbot@botmetro.net), which is an online dating site for people 18 and over. We noticed that many people under the age of 18 were chatting with the agent. We decided to ask the user’s birth date at the beginning of the conversation and if the user is under 18, we don’t allow him/her to chat with the agent.

You will want to stores users’ birth dates. You will then create a function that checks whether we have the user’s birth date when they begin a conversation with the agent. For example:

 

function GetBirthday()

  if Exist(G_USER_PROPS.Birthday)

    return G_USER_PROPS.Birthday

  return ""

 

A returning user who is over 18 will not have to enter his/her birth date.

You will add the following code to your overridden ABGreetingProc:

 

procedure overrides ABGreetingProc(FROM_USER_ARRIVES, NEW_USER)

  + SOMETHING=AnythingVeryStrong

  if !GetBirthday()

    - You must be at least 18 years old to interact with me.

      <empty/>

      What is your date of birth? Please enter your date of birth in MM/DD/YYYY format.

    while !GetBirthday()

      ? My birthday is BIRTHDAY=ADateAsNumbers {score=110}

      + BIRTHDAY=ADateAsNumbers {score=110}

        AGE = GetAgeFromBirthday(BIRTHDAY)

        if AGE < 18

          - Sorry! You have to be 18 or older to talk to me.

          while 1

            + =AnythingPerfect

              - Sorry! You have to be 18 or older to talk to me.

              restart dialog

 
You can find the various date subpatterns included above in the BuddyScriptLib.

Once we know the user is under 18, he/she will get the same message over and over no matter what he/she types. If you have another agent developed and live that is appropriate for all ages, you may want to suggest the user add that agent to his/her Contact List.

In the live agent, it looks like this:

 

MSN Dating Bot says:

You must be at least 18 years old to interact with me.

 

What is your date of birth? Please enter your date of birth in MM/DD/YYYY format.

Britt says:

05/15/1999

MSN Dating Bot says:

Sorry! You have to be 18 or older to talk to me.

Britt says:

Come on!

MSN Dating Bot says:

Sorry! You have to be 18 or older to talk to me.