Giter Site home page Giter Site logo

fbpages-telegram-bot's Introduction

Codacy Badge GitHub license Python Versions Contact me on Telegram

fbpages-telegram-bot

Introduction

A bot to forward Facebook page updates to a Telegram channel.

This bot is written in Python and uses the python-telegram-bot wrapper for the Telegram Bot API and the facebook-sdk client library for the Facebook Graph API.

Setup

Preparatory Setup

fbpages-telegram-bot uses Python 3 (developed and tested with version 3.6.0), which can be downloaded here if you are running Windows, or by installing the python3 package with your package manager if you're running Linux.

Example for Linux's apt-get:

sudo apt-get install python3 -y

You'll also need the following packages:

  • python-telegram-bot
  • facebook-sdk
  • youtube-dl

These can all be installed with:

pip3 install python-telegram-bot, facebook-sdk, youtube-dl

on both Windows's Command Prompt and Linux's terminal.

Bot Setup

To get started with the bot itself:

  1. Message @BotFather on Telegram to create a new bot and get its token.
  2. Start a conversation with your new bot and send any message to it. You can go to https://api.telegram.org/bot<BOTID>/getUpdates to find your user_id or chat_id to use in the settings file.
  3. Add your newly created bot as an administrator of the channel that will receive the posts.
  4. Create a Facebook App and then go to the Graph API Explorer. Choose your new app in the top right corner, and then click on Get Token, Get App Token. The Access Token field will now have the token required for the Facebook section of the settings file.
  5. Clone the repository with git clone https://github.com/s1cp/fbpages-telegram-bot.git
  6. Enter the new directory with cd fbpages-telegram-bot
  7. Set the appropriate values in a file called botsettings.ini. Use example.botsettings.ini as an example with cp example.botsettings.ini botsettings.ini && nano botsettings.ini.
  8. Run the bot with python3 facebook2telegram.py

Bot configuration values

Facebook section

Name Description
locale Facebook locale. Format example: en-US
token Facebook Graph API token.
pages List of page IDs. Format example: ['123456789',pageusername']
refreshrate Time interval between every Facebook check, in seconds.
status Allow status posts. Format: True or False
photo Allow photo posts. Format: True or False
video Allow video posts. Format: True or False
link Allow link posts. Format: True or False
shared Allow shared posts. Format: True or False
message Allow message in posts. Format: True or False

Telegram section

Name Description
token Telegram Bot API token.
channel Username of the channel that will receive the posts
admin Optional. Bot creator's ID to receive the bot's status.

fbpages-telegram-bot's People

Contributors

damorosodaragona avatar codacy-badger 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.