Wikibot is a Facebook Messenger Chatbot that searches and gathers information from Wikipedia. It uses the Wikipedia API for faster information gathering.
It aims to provide Wikipedia access to free data and mobile users.
demo.mp4
Simply clone the repository
git clone https://github.com/AlecBlance/WikiBot.git
Or download it as a zip file in the upper right corner.
The configuration includes two parts, the Facebook configuration and the WikiBot configuration. In order for the WikiBot to run it needs to have the following:
- Generated page token
- App secret key
- Developer's verification
$config = [
'facebook' => [
'token' => '<FB PAGE TOKEN>',
'app_secret' => '<APP SECRET KEY>',
'verification'=>'<VERIFICATION>',
],
'botman' => [
'conversation_cache_time' => 0
]
];
These can be gathered in Facebook Developers' App Dashboard.
Getting Page Token:
- Create your Facebook Page
- Go to Facebook Developers
- Create your App
- Set up Messenger as your product
- Under "Access Token", add your page and generate a token (Take note of the token)
Getting App Secret Key
- Go to Settings > Basic
- In the App Secret, click Show (Take note of key)
- Go to the cloned repository
- Edit the WikiBot.php and find the following code:
$config = [
'facebook' => [
'token' => '<FB PAGE TOKEN>',
'app_secret' => '<APP SECRET KEY>',
'verification'=>'<VERIFICATION>',
],
'botman' => [
'conversation_cache_time' => 0
]
];
- Insert your Page token, App secret key and desired verification (e.g. wikibot)
- Save :)
To run the WikiBot, a server must host the cloned repository. You may host it from your local XAMPP and deploy it online via ngrok or you may choose 000webhost instead.
Facebook requires https domain
For your Facebook page to run the WikiBot:
- Go to your app dashboard
- Then go to Messenger > Settings
- Under Webhooks, add your Callback URL Callback URL: https://your-server.com/WikiBot.php Verify Token: Your verification set in config (e.g. wikibot)
- Click Verify and Save
- Still, under Webhooks, click the edit button (same row with the page)
- Add these as subscriptions: messages, messaging_postbacks
To add a Get Started button in your WikiBot, run this curl command along with your "Page Access Token"
curl -X POST -H "Content-Type: application/json" -d '{
"get_started": {"payload": "menu"}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>"
This is the final process.
- Go to your Messenger
- Search for your Page
- Click it and you will see the Get Started Button
- Proceed and Enjoy ^_^
BotMan - PHP Framework for ChatBot Development PHP - Programming Language Composer - # Dependency Manager for PHP
- Alec Blance
This project is licensed under the MIT License - see the LICENSE file for details
- This project is made possible by BotMan PHP Framework