Home
About me
Medium
GitHub
Mastodon
Twitter
WeChat
Blogspot
Credly
April 18, 2018 / Tags: blog - code - ruby - chatbot - ai - watson
Tweet A Ruby chatbot for IBM Watson Assistant
Check out this Ruby gem that I created for connecting with Watson Assistant chatbots. Once installed, you can exercise the dialogs that use the intents and entities in your Watson Assistant workspace or skill with just a few lines of code.
First, install the Ruby gem:
gem install watson-assistant-chatbot
Next, create your chatbot instance, connect it with your Watson Assistant workspace by specifying the user_id, password, workspace_id, and optionally, api_version, and start having a conversation:
require 'watson-assistant-chatbot'
require 'json'
WatsonAssistant::Chatbot.api_version = '2018-02-16'
chatbot = WatsonAssistant::Chatbot.new('<user_id>', '<password>', '<workspace_id>')
request = { "input" => { "text" => "hello" } }
puts chatbot.message(request.to_json)
You can use this gem to quickly add a cognitive chatbot to your Rails or Sinatra web applications.
Get the Ruby source code of the gem from Github.
Watson Assistant is IBM’s framework for defining intents, entities, and dialogs to power cognitive chatbots. To learn how to use Watson Assistant to create your chatbot dialogs, follow this tutorial.
A Ruby chatbot for IBM Watson Assistant / April 18, 2018