1

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?

1 Answers1

2

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

Steve Worswick
  • 880
  • 2
  • 5
  • 11