👉 Developer Setup (without wit.ai) 👈
-
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). -
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. -
Don't forget to subscribe the webhook for your Page! 😃
-
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 👈
-
Go to wit.ai home page and create new application to get
WIT_ACCESS_TOKEN
. For more information: wit.ai quickstart is here 😉. -
Paste
WIT_ACCESS_TOKEN
to .env in career_bot application. -
Go to Facebook developers page and past your
WIT_ACCESS_TOKEN
in Messenger Settings in `Build-in NLP' section -
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
) -
Voila! Now you can add stories to Wit.ai (see quickstart for details) and test them by writing with messenger-bot. Enjoy! 😄
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: urszula.kowalska@elpassion.pl, katarzyna.laszczewska@elpassion.pl. Feel free to contact us anytime you need! 😁