This project is a chatbot that makes quiz. This program is worked on Facebook messenger by using Java, Spring boot and messenger4j.
- Git
- JDK 8 or later
- Maven 3.0 or later
- Mysql
Some basic Git commands are:
git clone https://github.com/veyselpehlivan/RestService.git
cd RestService
messenger4j.appSecret = ${MESSENGER_APP_SECRET}
messenger4j.verifyToken = ${MESSENGER_VERIFY_TOKEN}
messenger4j.pageAccessToken = ${MESSENGER_PAGE_ACCESS_TOKEN}
The configuration is located in src/resources/application.properties
- Git
- Ngrok
- Mysql
- Clone the project 2.Create a Facebook page
- open https://developers.facebook.com/apps
- click the 'Add a New App' button
- enter the Display Name, e.g. chatbot
- select the Category: 'Apps for Messenger'
- click the 'Create App ID' button
- Section 'Token Generation': Select your created FB Page, e.g. Messenger4j Demo
- copy the 'Page Access Token' to the clipboard
- paste this 'Page Access Token' to the
${MESSENGER_PAGE_ACCESS_TOKEN}
- navigate to 'Dashboard'
- copy the 'App Secret' to the clipboard
- paste this 'App Secret' to the
${MESSENGER_APP_SECRET}
- use a randomly generated string as 'Verify Token', e.g. retgdkfjsjklsklj34qdfs
- paste this 'Verify Token' to the
${MESSENGER_VERIFY_TOKEN}
- run the code
- open the ngrok
- create a callback url by using ngrok
- navigate back to 'Messenger'
- Section 'Webhooks': Click the 'Setup Webhooks' button
- enter the Callback URL that is generated by ngrok enter the generated Verify Token, e.g. retgdkfjsjklsklj34qdfs
- select the following Subscription Fields: messages, messaging_postbacks, messaging_optins, message_deliveries, message_reads, messaging_account_linking, message_echoes
- click the 'Verify and Save' button
- Section 'Webhooks': Select your created FB Page to subscribe your webhook to the page events
- click the 'Subscribe' button
- Send 'Start' message