Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Message

Ben edited this page Mar 13, 2016 · 4 revisions

With wit_bot, a message is a text query that can be sent to wit.ai for processing (it's pretty much the entire purpose of wit_bot).

Create a message:

message = WitBot::Message.new WitBot.thread, "This is a cool test.", id: SecureRandom.uuid
message = WitBot::Message.new "This is a cool test." # thread and id are by default the values I gave above
message = WitBot.thread.create_message "This is a cool test." # you can create messages off of threads
message = WitBot.create_message "This is a cool test." # Same as above.

Once you've done so, you can send it to wit.ai for processing:

message.send

After that's done, the follow attributes are set:

message._text #=> the text wit.ai interpreted the message as.
message.id #=> the id of the message wit.ai sent back 
message.sent #=> true
message._outcomes #=> raw outcomes
message.outcomes #=> outcomes
message.outcome #=> most probable outcome

Getting Started

Here's how to get started with wit_bot in 3 steps:

  1. Learn how to use wit.ai
  2. Learn how to setup the gem
  3. Learn how to send a message

Dive Deeper

Create Bots

Integrate it

Clone this wiki locally