This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
Ben edited this page Apr 3, 2016
·
3 revisions
A conversation is a Observable object, which keeps track of a thread. When a message is sent to the conversation, it is first sent to the thread, then to wit.ai, then to listeners as an :input
event. When a message is outputted, it is sent to the thread as a bot message, then to listeners as an :output
event. For example, a bot will listen for these :input
events, do things, and then send an output event. You can use the WitBot::Bot::Conversation::Participant
class to make listening to events easier.
To create a conversation, create an instance of WitBot::Bot::Conversation::Base
:
conversation = WitBot::Bot::Conversation::Base.new
To send a message, do:
conversation.input "This is a cool test." # Marked as input (a user message)
conversation.output "This is a cool test." # Marked as output (a bot message)
conversation.send_message "This is a cool test." # Marked as input by default, unless 2nd arg is passed, responds to `#bot?`, and `#bot?` evaluates to true.
Down here?
Cool.
I should add something somewhat interesting for you to read...
Here's how to get started with wit_bot in 3 steps:
- Learn how to use wit.ai
- Learn how to setup the gem
- Learn how to send a message
- Learn how to use message threads
- Learn how to use context
- Learn how to use conversations
- Learn to use the REPL
- Learn how to use conversations
- Learn how to use participants
- Learn how to use bots