Sourcebot
所属分类:通讯编程
开发工具:PHP
文件大小:0KB
下载次数:0
上传日期:2018-11-26 12:05:40
上 传 者:
sh-1993
说明: 一个开源新闻机器人,帮助非洲新闻机构提供个性化新闻,并通过消息传递平台更有效地参与。,
(An open source newsbot to help African news organisations deliver personalized news and engage more effectively via messaging platforms.,)
文件列表:
Procfile (40, 2018-11-26)
app.json (1181, 2018-11-26)
composer.json (263, 2018-11-26)
composer.lock (43647, 2018-11-26)
log.txt (390166, 2018-11-26)
web/ (0, 2018-11-26)
web/.htaccess (85, 2018-11-26)
web/Procfile (40, 2018-11-26)
web/app.json (847, 2018-11-26)
web/composer.json (263, 2018-11-26)
web/composer.lock (34134, 2018-11-26)
web/config/ (0, 2018-11-26)
web/config/conn.php (527, 2018-11-26)
web/config/db.php (102, 2018-11-26)
web/config/setup.php (7782, 2018-11-26)
web/curl_requests/ (0, 2018-11-26)
web/curl_requests/get_started_curl_request.txt (204, 2018-11-26)
web/curl_requests/persistent_menu_curl_request.txt (1288, 2018-11-26)
web/curl_requests/persistent_menu_payload.json (829, 2018-11-26)
web/images/ (0, 2018-11-26)
web/images/favicon.png (687, 2018-11-26)
web/images/lang-logo.png (1066, 2018-11-26)
web/images/sourcebot.png (149401, 2018-11-26)
web/images/sourcebot_1024.png (822737, 2018-11-26)
web/images/sourcebot_512.png (176699, 2018-11-26)
web/images/sourcebot_512_transparent.png (1049386, 2018-11-26)
web/images/sourcebot_profile_pic.png (149401, 2018-11-26)
web/inc/ (0, 2018-11-26)
web/inc/db_queries.php (3722, 2018-11-26)
web/inc/elasticsearchcalls.php (15342, 2018-11-26)
web/inc/graphapi.php (2908, 2018-11-26)
web/inc/messengerpayloads.php (37813, 2018-11-26)
web/inc/supportcalls.php (689, 2018-11-26)
web/inc/supportfunctions.php (1011, 2018-11-26)
web/index.php (11693, 2018-11-26)
web/io/ (0, 2018-11-26)
web/io/.htaccess (85, 2018-11-26)
... ...
# Sourcebot
An open source Facebook Messenger news bot for your Wordpress website
To help African news organisations deliver personalized news and engage more effectively via messaging platforms.
- [Develop](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/#develop)
- [Test](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/#test)
- [Build](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/#build)
- [Deploy](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/#deploy)
- [Run](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/#run)
- [Contribute](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/#contribute)
- [Notes](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/#notes)
## Sourcebot version 1.X
##
Develop
### Requirements
- A [Facebook Page](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://web.facebook.com/pages/create)
- A [Facebook App](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://developers.facebook.com/apps/) with the Facebook Messenger product
- [PHP 7.1+](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/http://php.net/downloads.php)
- [Xdebug](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://xdebug.org/download.php)
- [Composer](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://getcomposer.org/)
- A local web-server e.g. [Apache](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://www.apache.org/dyn/closer.cgi)
- A publicly accessible URL e.g. [ngrok](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://ngrok.com/)
- A Wordpress instance with the [Wordpress REST API](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://wordpress.org/plugins/rest-api/)
### First time
- Run `composer install`
- Visit localhost to confirm you see `index.php`
- Run `cp .env.example .env`
- Edit `.env`
- Run `phpunit`
- Run `ngrok http 80` to get the publicly accessible URL
- Go to your [Facebook App](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://developers.facebook.com/apps/)
- Click `Webhooks`
- Select `Page` from the drop-down
- Click `Subscribe to this topic`
- Enter the publicly accessible URL of your app and `/webhook.php`
- Enter the `FACEBOOK_VERIFY_TOKEN`
- Click `Verify and Save`
- Visit [Facebook Messenger](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://messenger.com)
- Search for your Facebook Page and send it a message
##
Test
Tests are run with `phpunit`
##
Build
Sourcebot is configured to build on [CircleCI](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://circleci.com/).
You can run local CircleCI builds with `circleci build` using the [CircleCI CLI](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://circleci.com/docs/2.0/local-jobs/).
##
Deploy
### Sourcebot Setup and Deploy Video Tutorial
[![Setup Video](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://img.youtube.com/vi/h7NNFD03Xnc/0.jpg)](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://www.youtube.com/watch?v=h7NNFD03Xnc)
Here is the full setup process on [Medium](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://medium.com/sourcebot/sourcebot-setting-up-and-configuring-sourcebot-89aa7d91b4cf)
You can deploy Sourcebot to your own web-server or quickly and for free to Heroku.
[![Deploy](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://www.herokucdn.com/deploy/button.svg)](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://heroku.com/deploy)
The latest release of Sourcebot is now supported! Changes include:
* Requires PostgresSQL database, available through add-ons:
* [Heroku-Postgresql](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://elements.heroku.com/addons/heroku-postgresql) (deploy default)
* It also requires an instance of Elasticsearch
* [Bonsai-Elasticsearch](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://elements.heroku.com/addons/bonsai) (deploy default)
* `HEROKU_URL` config var renamed to `PUBLIC_URL` to avoid using Heroku's namespace
* `DATABASE_URL` config var will be set for you to access your database
### Things you should know
### Requirements
- A [Facebook Page](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://web.facebook.com/pages/create)
- A [Facebook App](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://developers.facebook.com/apps/) with the Facebook Messenger product
- [PHP 7.1+](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/http://php.net/downloads.php)
- [Composer](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://getcomposer.org/)
- A web-server e.g. [Apache](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://www.apache.org/dyn/closer.cgi)
- SSL must be configured
- A Wordpress instance with the [Wordpress REST API](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://wordpress.org/plugins/rest-api/)
### Before Deploy
Before deploying you probably want to give your bot a nice home page as `web/index.php` currently displays this `README.md`.
### After Deploy
Once you have Sourcebot running on a publicly accessible URL you need to set and verify your Facebook App's Webhook.
## Local
- Go to your [Facebook App](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://developers.facebook.com/apps/)
- Click `Webhooks`
- Select `Page` from the drop-down
- Click `Subscribe to this topic`
- Enter the URL of your app and `/webhook.php`
- Enter the `FACEBOOK_VERIFY_TOKEN`
- If you are using Heroku then it was autogenerated and you can get it from the `Reveal Config Vars` section of your Heroku app's `Settings`
- Click `Verify and Save`
- Visit [Facebook Messenger](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://messenger.com)
- Search for your Facebook Page and send it a message
## HEROKU_URL
- Go to your [Facebook App](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://developers.facebook.com/apps/)
- Click `Webhooks`
- Select `Page` from the drop-down
- Click `Subscribe to this topic`
- Enter the URL of your app and `https://YOURAPPNAME.herokuapp.com/`
- Visit [Facebook Messenger](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://messenger.com)
- Search for your Facebook Page and send it a message
##
Run
To check Sourcebot can connect to your Wordpress go to
/wordpress-api-status.php
##
Contribute
Contributions are welcome and follows the straightforward Github pull request process:
- Fork
- Code
- Test
- Submit a pull request
##
Notes
### Facebook Page and App
- Facebook Messenger requires SSL/HTTPS to communicate with Sourcebot.
- The [quickstart](https://github.com/EuropeanJournalismCentre/Sourcebot/blob/master/https://developers.facebook.com/docs/messenger-platform/guides/quick-start) guide is useful for setting up your Facebook Page and Facebook App. You do not need to follow the Node.js instructions.
- Make sure you associate your Facebook App with your Facebook Page in `Settings -> Advanced -> App Page`.
- Your Facebook App has to be reviewed for the `pages_messaging` permission. Before it is approved only Administrators, Developers, and Testers on the Facebook App's Roles page can interact with the bot.
- You can only have one webhook endpoint setup per Facebook App so you probably want a `development` and a `production` Facebook App at least.
- You can only associate one Facebook App per Facebook Page so you probably want a `development` and a `production` Facebook Page at least.
近期下载者:
相关文件:
收藏者: