{"id":20481177,"url":"https://github.com/himanshugoyal-git/rails-bot","last_synced_at":"2026-04-30T06:33:10.027Z","repository":{"id":56890477,"uuid":"124756887","full_name":"himanshugoyal-git/rails-bot","owner":"himanshugoyal-git","description":"For Creating Bots in Rails","archived":false,"fork":false,"pushed_at":"2018-03-25T04:17:05.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-30T06:33:07.859Z","etag":null,"topics":["bot","chat","chat-application","chatbot","dialog","dialogue","rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/himanshugoyal-git.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-11T13:01:18.000Z","updated_at":"2021-01-12T12:32:57.000Z","dependencies_parsed_at":"2022-08-20T16:00:55.419Z","dependency_job_id":null,"html_url":"https://github.com/himanshugoyal-git/rails-bot","commit_stats":null,"previous_names":["erhimanshugoyal/rails-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/himanshugoyal-git/rails-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanshugoyal-git%2Frails-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanshugoyal-git%2Frails-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanshugoyal-git%2Frails-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanshugoyal-git%2Frails-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/himanshugoyal-git","download_url":"https://codeload.github.com/himanshugoyal-git/rails-bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanshugoyal-git%2Frails-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32457110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","chat","chat-application","chatbot","dialog","dialogue","rails"],"created_at":"2024-11-15T16:07:13.824Z","updated_at":"2026-04-30T06:33:10.011Z","avatar_url":"https://github.com/himanshugoyal-git.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rails::Bot\nBuilding a bot for the chatting functionality in the Rails Application. Write now using GoogleCustomSearchApi for the query part. You can check it out here: https://www.ideakart.com (For Desktop Version Only)\n\n\u003ca href=\"https://badge.fury.io/rb/rails-bot\"\u003e\u003cimg src=\"https://badge.fury.io/rb/rails-bot.svg\" alt=\"Gem Version\" height=\"18\"\u003e\u003c/a\u003e\n\n## Usage\n\nRails::Bot.conversation(message)\n=\u003e \"Hey Just received your message: #{message}\"\n\nRails::Bot.search(message)\n=\u003e #This return the results from the google custom search API\n\nRead this, as a part of this gem uses this for query\nhttps://github.com/wiseleyb/google_custom_search_api\n\n## Configure:\nYou need to configure GOOGLE_SEARCH_CX and GOOGLE_API_KEY to config/initializers/google_cse_api.rb:\n\n  GOOGLE_API_KEY = \"...\"\n  GOOGLE_SEARCH_CX = \"...\"\n\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rails-bot'\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install rails-bot\n```\n\nThen, create the files and initializers code, make sure you have installed \"gem 'google_custom_search_api'\", \"gem 'devise'\"\n\n```bash\nrails g rails:bot:initializer\n```\nThe above would create files for you\n\n      create  config/initializers/google_initializer.rb =\u003e For the google custom seacrh API\n      create  config/initalizers/warden_hooks.rb =\u003e For Validation at Websocket Connection\n      create  app/views/shared/_chat.html.erb =\u003e For rendering the view for chat\n      create  app/channels/chat_channel.rb =\u003e For communicating with the client\n      create  app/assets/javascripts/channels/chat.coffee =\u003e For communicating with the server\n      create  app/jobs/ruby_bot_job.rb =\u003e Bot Responds via this Active Job\n\nIn your application.html.erb, in body add this\n\n```ruby\n  \u003c%= render \"shared/chat\"%\u003e\n```\n\nPost that add these methods to your ApplicationHelper(application_helper.rb)\n```ruby\n  def resource_name\n    :user\n  end\n\n  def resource\n    @resource ||= User.new\n  end\n\n  def devise_mapping\n    @devise_mapping ||= Devise.mappings[:user]\n  end\n```\n  \n  Post that add this to your connection.rb\n```ruby  \n  identified_by :current_user\n \n    def connect\n      self.current_user = find_verified_user\n    end\n     \n    private\n      def find_verified_user\n        if current_user = User.find_by(id: cookies.signed['user.id']) \n          current_user\n        else\n          reject_unauthorized_connection\n        end\n      end\n```\n\n\n\n## Contributing\nContribution directions go here.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimanshugoyal-git%2Frails-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhimanshugoyal-git%2Frails-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimanshugoyal-git%2Frails-bot/lists"}