Integration of chatbot using Ruby on Rails

Amit Bairagi
Aug 23, 2017 · 2 min read

Definition of a Chatbot

A computer program designed to simulate conversation with human users, especially over the Internet. Such programs are often designed to convincingly simulate how a human would behave as a conversational partner. Chatbots are typically used in dialog systems for various practical purposes including customer service or information acquisition.

How it works

Systems scan for keywords within the input given by the user, and then pull a reply with the most matching keywords, or the most similar wording pattern, from a database. Natural Language Processing AKA NLP engine allows you to enter questions the way they would be asked by a human, and it processes them. Here in today’s demo we will be using Ruby NLP.

Examples of chatbots

  • Kik Bot (Whether, Translation)
  • Operator (For ecommerce)
  • Mitsuku
  • Right Click
  • Poncho (Whether)
  • Melody by Baidu

Typical uses of chat bots

  1. Order Pizza (Domino)
  2. Product Suggestions
  3. Customer Support (AirBnb)
  4. Weather (Kik Bot)
  5. Schedule a Meeting
  6. Search for & Track Flights
  7. News
  8. Find a Restaurant (Google’s ALO)

Advantages of Chatbots

  • Product Analytics
  • Save Resources (Feedback system)
  • Answering FAQs (Automation)
  • Event reservation
  • Agenda/Scheduling (Via Calender)

Building ChatBot with Ruby

  • We are using Ruby NLP for telegram :
  • Gem ‘telegram-bot-ruby’

Prerequisites

  • Have account in telegram
  • Gem should be installed and required
  • Generate token for your personalized bot

Steps of creating a Bot

  • Create an account in telegram
  • Telegram offers ‘Developers API’ and ‘Bot api’
  • We can use either app or web-version to sign in
  • Users can interact with bots by sending them commands in private or group chats. We control our bots
  • using HTTPS requests to the bot API.

Search and start chat with BotFather

  • BotFather helps to create our own bot with the use of already programmed commands.
  • Command to create a bot : /newbot
  • We should assign a name and username for that bot.

Looking to get your app developed? RailsCarma can help! Check out our portfolio to understand how we are helping to change the shape of software industry by providing Ruby on Rails Developer. Get in touch with us now!

More From Medium

Also tagged Ruby on Rails

Top on Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade