Giter Club home page Giter Club logo

messenger-bot's Introduction

Build Status

๐Ÿค–โญ๏ธ๐Ÿค– EL Passion Career Bot ๐Ÿค–โญ๏ธ๐Ÿค–

โ€ผ๏ธ NEW FEATURE ALERT: Application proccess via Messenger โ€ผ๏ธ

Now you can apply for selected job offer through Messenger. Bot uses question parsed from Workable offers, saves user responses and send them back to Workable. Paste your Workable token to ENV variables to make it work - and it's done!

๐Ÿ‘‰ Developer Setup (without wit.ai) ๐Ÿ‘ˆ

  1. After cloning the repo, go to Messenger Platform Quick Start and follow the instructions. You will need to create Facebook Page & App and provide ACCESS_TOKEN, APP_SECRET variables to .env.development file (you can find all useful variable names in .env.sample - you can copy it to your .env file and then paste your variables).

  2. To setup Webhook you need to use ngrok and https URL: https://<ngrok_address>/bot. Then, with verify token matching the one from .env file and running server (hanami s), you should be able to Verify and Save the Webhook.

  3. Don't forget to subscribe the webhook for your Page! ๐Ÿ˜ƒ

  4. Your application is now working and responding to postback requests. ๐ŸŽ‰ You are still unable to fetch job offers until you provide WORKABLE_API_KEY variable.

๐Ÿ‘‰ Add wit.ai to your application ๐Ÿ‘ˆ

  1. Go to wit.ai home page and create new application to get WIT_ACCESS_TOKEN. For more information: wit.ai quickstart is here ๐Ÿ˜‰.

  2. Paste WIT_ACCESS_TOKEN to .env in career_bot application.

  3. Go to Facebook developers page and past your WIT_ACCESS_TOKEN in Messenger Settings in `Build-in NLP' section

  4. We use Sidekiq to handle Wit.ai requests and responses, so you need to start it locally (use the following command: bundle exec sidekiq -e development -c 5 -r ./config/environment.rb)

  5. Voila! Now you can add stories to Wit.ai (see quickstart for details) and test them by writing with messenger-bot. Enjoy! ๐Ÿ˜„

๐Ÿ‘‰ Using existing Wit.ai project ๐Ÿ‘ˆ

You can start your own project from the scratch but you can also use the one created by us. You will find it here.

Our Wit.ai stories use following methods implemented on backend:

Warning: Because wit.ai stories are deprecated we are moving stories implementation here

โ†’ check_sentiment - used to check user's input - if there are any insult words, bot sends message with link to conversation with real person:

โ†’ clean_context - cleans conversation context after game.
Also, when user didn't write anything by more than 15 minutes, context cleans by default when he starts conversation with bot again.

โ†’ play_game, start_game - methods used in simple 'guess my number' game:

โ†’ get_job - matches user's input with job offers parsed from Workable. There are three cases - more info here:

โ†’ get_details - gets details (benefits or requirements) about selected job offer from database:

โ†’ get_random_answer - sends random 'I don't know how to reply.' message.
You can find random messages in en.yml file, under unrecognized key:

โ†’ get_social_network - gets link to company social network requested by user.
Social networks with link are predefined in social_networks.yml file:

โ†’ get_user - gets user's name from his/her Messenger account:

โ†’ send_error_message - 'when something went wrong', e.g. with Wit.ai message:

โ†’ send_random_gif - sends random gif with animals from Giphy:

โ†’ show_about_us, show_main_menu - allows user to acces main menu and 'about us' info without clicking on the buttons:

-> update_notifications - allows user to subscribe to notifications.

How to send a message to subscribed users?

You need to execute rake task with message you want to send as an attribute. To do that, type bundle exec rake send_notifications['Message to send.']. That's it.

***********************************

If you have any troubles with configuration - here are our emails: [email protected], [email protected]. Feel free to contact us anytime you need! ๐Ÿ˜

messenger-bot's People

Contributors

ulska avatar klaszcze avatar wswidzinski avatar kalorz 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.