Ruby library for
Clone or download
aforaleka and blandinw Sunset stories (#26)
* sunsetting stories: removing converse and run_actions
Latest commit c590b81 Feb 8, 2018


wit-ruby is the Ruby SDK for


From RubyGems:

gem install wit

From source:

git clone
gem build wit.gemspec
gem install wit-*.gem


Run in your terminal:

ruby examples/basic.rb <your_token>

See the examples folder for more examples.



wit-ruby provides a Wit class with the following methods:

  • message - the Wit message API
  • interactive - starts an interactive conversation with your bot

Wit class

The Wit constructor takes a Hash with the following symbol keys:

  • :access_token - the access token of your Wit instance

A minimal example looks like this:

require 'wit'

client = access_token)
client.message('set an alarm tomorrow at 7am')


The Wit message API.

Takes the following parameters:

  • msg - the text you want to extract the information from


rsp = client.message('what is the weather in London?')
puts("Yay, got response: #{rsp}")


Starts an interactive conversation with your bot.



CRUD operations for entities

payload in the parameters is a hash containing API arguments


Returns a list of available entities for the app.
See GET /entities


Creates a new entity with the given attributes.
See POST /entities


Returns all the expressions validated for an entity.
See GET /entities/:entity-id

.put_entities(entity_id, payload)

Updates an entity with the given attributes.
See PUT /entities/:entity-id


Permanently remove the entity.
See DELETE /entities/:entity-id

.post_values(entity_id, payload)

Add a possible value into the list of values for the entity.
See POST /entities/:entity-id/values

.delete_values(entity_id, value)

Delete a canonical value from the entity.
See DELETE /entities/:entity-id/values/:value

post_expressions(entity_id, value, payload)

Create a new expression of the canonical value of the entity.
See POST /entities/:entity-id/values/:value/expressions

delete_expressions(entity_id, value, expression)

Delete an expression of the canonical value of the entity.
See DELETE /entities/:entity-id/values/:value/expressions/:expression

See the docs for more information.


Default logging is to STDOUT with INFO level.

You can setup your logging level as follows:

Wit.logger.level = Logger::WARN

See the Logger class docs for more information.


Thanks to Justin Workman for releasing a first version in October 2013. We really appreciate!