/app-chat-bot-workshop

A simple chat bot Workshop

Primary LanguagePHP

Chat Bot Workshop

Facebook ChatBot that was created during the Paysera workshop.

Requirements

  • PHP >=5.5
  • composer
  • ngrok
  • Facebook Account

Setup instructions

PHP server

For simplicity of this task, we will use built-in PHP server.

  • install dependencies with composer install
  • from project's directory run in console php -S localhost:9999.
  • check local PHP server is running - in browser go to http://localhost:9999/ - you should see a blank page.

ngrok

Ngrok is local proxy allowing your PC to be accessible from Internet.

Facebook App Setup

  1. Chatbot will need a facebook page to work. Create page in facebook if you don't have one

  2. Go to Developer facebook.com and click Add new App

    1. Enter the name of your app (ex. Chatbot workshop)
  3. You will be redirected to you project configuration page

  4. Fill required steps:

    1. Get your App id and App secret
    2. Add messenger product to your application
    3. Select page that will use this app (may require to add permissions). Page Access Token will be generated. Add it to your application
    4. Click Subscribe To Events in Webhooks section
    5. Fill url you got from ngrok setup, other fields should be as it is in screenshot.
    6. Select a page to subscribe your webhook to the page events
  5. If everything was according to plan, you can open Messenger, search for chat bot and he should reply to you.

Changed ngrok hostname?

In case you restarted ngrok, you will receive a new public hostname, you need to change it in App Webhooks