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
Message Threads
Ben edited this page Mar 13, 2016
·
6 revisions
Threads let you group messages together. Think of them like an array of messages.
To create a thread, create a new MessageThread
, optionally with a unique id:
thread = WitBot::MessageThread.new #=> WitBot::MessageThread
thread = WitBot::MessageThread.new("12345") #=> WitBot::MessageThread
Or, for convenience:
thread = WitBot.thread #=> WitBot::MessageThread
Now, when creating a message, pass the thread as the first parameter:
message = WitBot::Message.new thread, "This is a cool test."
Or, for convenience:
message = thread.create_message "This is a cool test."
Threads are extremely useful for storing a conversation, and are messages even grouped together in wit.ai logs. With wit_bot, threads also store context information, like state.
Here's an example script taking advantage of threads and context.
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