Code Monkey home page Code Monkey logo

sourcebot's Introduction

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.

Sourcebot version 1.X

Develop

Requirements

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
  • 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
  • Search for your Facebook Page and send it a message

Test

Tests are run with phpunit

Build

Sourcebot is configured to build on CircleCI.

You can run local CircleCI builds with circleci build using the CircleCI CLI.

Deploy

You can deploy Sourcebot to your own web-server or quickly and for free to Heroku.

Deploy

The latest release of Sourcebot is now supported! Changes include:

  • Requires PostgresSQL database, available through add-ons:
  • It also requires an instance of Elasticsearch
  • 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

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
  • 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
  • Search for your Facebook Page and send it a message

HEROKU_URL

  • Go to your Facebook App
  • 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
  • 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 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.

sourcebot's People

Contributors

kuzy avatar europeanjournalismcentre avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.