Giter VIP home page Giter VIP logo

ruby-whatsapp-bots's Introduction

WhatsApp Bots built in Ruby

This is a repo of WhatsApp bots built in Ruby using the Twilio API for WhatsApp.

Available bots

There is one bot so far:

  • Keyword bot: a Sinatra application that can return facts and pictures about dogs and cats based on the keywords you send to it

How to build a bot

See the blog post Build a WhatsApp chatbot with Ruby, Sinatra and Twilio to see how to get started with building bots.

Running the bots

You will need the following to run the bots in this repo:

Configure the Twilio sandbox for WhatsApp

  • Head to the WhatsApp sandbox area of the Twilio console, or navigate from the console to Programmable SMS and then WhatsApp
  • The page will have the WhatsApp sandbox number on it. Open your WhatsApp application and start a new message to that number
  • The page also has the message you need to send, which is "join" plus two random words, like "join flagrant-pigeon". Send your message to the sandbox number

Running an application

Download or clone the app

Clone the application to your machine with the following command:

git clone https://github.com/philnash/ruby-whatsapp-bots.git
cd ruby-whatsapp-bots

Install dependencies

Install the dependencies with bundler:

bundle install

Configure the environment

Copy the config example file:

cp config/env.yml.example config/env.yml

Get your Twilio auth token from your Twilio console and add it to config/env.yml.

To use the location bot, sign up for a free Dark Sky API key and add that to config/env.yml.

Run the app

Change into the directory of the bot you want to run. Then run the application with:

bundle exec rackup

ngrok

Run ngrok to tunnel through to localhost:9292:

ngrok http 9292

Take your ngrok URL and the path to your bot, https://YOUR_NGROK_SUBDOMAIN.ngrok.io/bot and enter it in the WhatsApp sandbox admin in the input marked "When a message comes in" and save the configuration.

Now send your bot a message and wait for the response.

License

These bots are licensed under the MIT license.

ruby-whatsapp-bots's People

Contributors

philnash avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.