Upkey Chatterly Client
The Upkey Chatterly Client is a Ruby client used for providing a simple, standardized interface for the Upkey::Chatterly API. Using it will allow you to easily simulate a ChatBot interface and provide interactive dialog for your Users.
Installation
Add this line to your application's Gemfile:
gem 'upkey-chatterly-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install upkey-chatterly-client
Usage
To begin you will want to create a file named chatterly.rb
in config/initializers
. This is where we are going to create the global client.
$chatterly = Upkey::Chatterly::Client.new({
access_key: YOUR_ACCESS_KEY,
chatterly_url: CHATTERLY_URL
})
This will create a useable client, saved in $chatterly
. There are now two instances where we would use this client: Getting the initial message of a conversation and responding to the User. These are their steps:
#Getting the Initial Message
$chatterly.respond({ key: :topic, id: topic_id })
#Respoding to a User
$chatterly.respond({ key: :response, id: response_id })
Both will respond with an Upkey::Chatterly::Response
object, with two attributes: message
, which will return the next message in the conversation (either the initial one for a topic or what the response linked to), and responses
, which contains an array of options to respond to the given message.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/upkey-chatterly-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Upkey::Chatterly::Client project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.