Skip to main content

fbbot is a simple Django app to showcasing the Messenger Platform, make your facebook bot with Django

Project description

fbbot is a simple Django app to showcasing the Messenger Platform, make your facebook bot with django

Quick start

Note. If yo don’t have a https server and domain. For development purposes I use NGROK, a good “Secure tunnels to localhost” service ( url:https://ngrok.com/ ):

> Download ngrok binary https://ngrok.com/download
> execute ./ngrok http 8000
> Copy url like '12345678.ngrok.io'
  1. Clone this repo and install the requeriments:

    git clone https://github.com/espacioAntonio/Django-messenger-platform-bot.git
    cd Django-messenger-platform-bot
    pip install -r requirements.txt
    
  2. Add your valid settings in ./fbbot/settings.py:

    FB_PAGE_TOKEN = "FACEBOOK_PAGE_TOKEN"
    FB_VERIFY_TOKEN = "VERIFY_TOKEN_DEFINED_BY_DEVELOPER"
    REAL_URL = "URL_PROVIDED_BY_NGROK" #example: 12346578.ngrok.io or www.yourdomain.com
    
  3. Run:

    python manage.py runserver 8000
    
  4. Suscribe your new webhook in your Facebook App:

    WEBHOOK
    URL Callback: https://YOUR_REAL_URL/fbbot/webhook
    Verify Token: "VERIFY_TOKEN_DEFINED_BY_DEVELOPER"
    
  5. Visit http://127.0.0.1:8000/fbbot/webhook and see “Hello World, webhook enable” message.

  6. Send a message to your facebook page or send this messages:

    image
    gif
    audio
    file
    button
    generic
    receipt
    quick reply
    read receipt
    typing on
    typing off
    account linking
    

Integrate this app with your Django App

  1. Install the django-fbbot package with python-pip:

    pip install django-fbbot
    
  2. Add your valid tokens in your settings file mysite/settings.py:

    FB_PAGE_TOKEN = "FACEBOOK_PAGE_TOKEN"
    FB_VERIFY_TOKEN = "VERIFY_TOKEN_DEFINED_BY_DEVELOPER"
    REAL_URL = "URL_PROVIDED_FOR_NGROK" #example: 12346578.ngrok.io or www.yourdomain.com
    BASE_URL = "https://"+REAL_URL
    
  3. Add “fbbot” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'fbbot',
    ]
    
  4. Include the fbbot URLconf in your project urls.py like this:

    url(r'^fbbot/', include('fbbot.urls')),
    
  5. Run python manage.py collectstatic to collect files to test.

  6. Start the development server and visit http://127.0.0.1:8000/fbbot/webhook

  7. Visit http://127.0.0.1:8000/fbbot/webhook and see “Hello World, webhook enable”

  8. Send a message to your facebook page or send this messages:

    image
    gif
    audio
    file
    button
    generic
    receipt
    quick reply
    read receipt
    typing on
    typing off
    account linking
    

Uninstall

  1. If you want to uninstall this package run:

    pip uninstall django-fbbot
    
  2. Remove “fbbot” in your INSTALLED_APPS setting:

    INSTALLED_APPS = [
        ...
        'fbbot',
    ]
    
  3. Remove the fbbot URLconf in your project urls.py:

    url(r'^fbbot/', include('fbbot.urls')),
    

Project details


Release history Release notifications

This version
History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-fbbot-0.1.tar.gz (3.7 MB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page