{"id":25578599,"url":"https://github.com/lastaapps/fb-pages-discord-bot","last_synced_at":"2025-10-17T03:07:52.641Z","repository":{"id":255580983,"uuid":"817350149","full_name":"Lastaapps/fb-pages-discord-bot","owner":"Lastaapps","description":"Scrapes Facebook pages post and sends them to a discord channel","archived":false,"fork":false,"pushed_at":"2025-08-04T21:43:44.000Z","size":460,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-05T13:52:34.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lastaapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-19T14:16:06.000Z","updated_at":"2025-08-04T21:43:47.000Z","dependencies_parsed_at":"2025-03-07T13:35:57.302Z","dependency_job_id":"8b166d45-2f20-4dab-90b0-f962479f33d2","html_url":"https://github.com/Lastaapps/fb-pages-discord-bot","commit_stats":null,"previous_names":["lastaapps/fb-pages-discrod-bot","lastaapps/fb-pages-discord-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Lastaapps/fb-pages-discord-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lastaapps%2Ffb-pages-discord-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lastaapps%2Ffb-pages-discord-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lastaapps%2Ffb-pages-discord-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lastaapps%2Ffb-pages-discord-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lastaapps","download_url":"https://codeload.github.com/Lastaapps/fb-pages-discord-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lastaapps%2Ffb-pages-discord-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279275334,"owners_count":26138576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-21T03:16:16.827Z","updated_at":"2025-10-17T03:07:52.635Z","avatar_url":"https://github.com/Lastaapps.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FB Pages Discord Bot\n\nThe bot gets posts from the Facebook pages given and reposts them to\nspecified Discord channels.\n\nIt uses the official Facebook API to get the posts.\nYou can either host it yourself, or contact me, add the Discord bot and enjoy.\nTranslations from Czech are missing in both variants, feel free to create a PR.\n\n## TODO\n\n- add pictures into README\n- explicit post refresh request (updates the current post or posts a new one if the old one is deleted)\n- some bulk delete option/clear channel option\n\n## DC bot\n\nYou can add the bot hosted by me to your server using this\n[invite link](https://discord.com/oauth2/authorize?client_id=1252917635948216401).\nMake sure bot has access to the channels where you want to relay the posts (see bellow)\nUse the `fb_ping` command to test if the bot works.\nThe current refresh period can be seen when a new page is added.\nAlso, in case this bot becomes popular, the rate limit will be reached\nas login is not enabled for my instance - I can handle ~40 pages.\nSee also events section for details as events don't work correctly in this mode.\nI have plans to obtain necessary permissions from Facebook to overcome this issue.\n\nIf the bot does not work for you, please open an issue as it's still in a beta stage.\nThe bot is provided with no guaranties, see License.\n\n### Commands\n\nBot supports multiple commands.\nTheir availability may vary based on which FB authorization features are enabled.\n\n- `fb_ping` - tests connection and basic permissions\n- `fb_list_available` - pages that are available to the bot. If the bot has proper rights,\n  all the facebook pages are accessible.\n- `fb_list_local` - list pages that are relayed to this channel.\n- `fb_search` - searches FB for the given name and shows id's of the related pages\n- `fb_add_page` - add page posts to this channel, use page id, url name, ... Comma separated list is also supported.\n- `fb_remove_page` - removes pages from this channel, same interface as `fb_add_page`.\n- `fb_authorize_login` - shows link that can be used to log into the app and authorize more pages\n- `fb_authorize_user` - authorize pages of the user given by a `user_access_token`. System user token is also supported.\n\n### Permissions\n\nThe bot needs the following permission in the channel it's supposed to send messages into:\n\n- `View channel`\n- `Send messages`\n- `Embed links`\n- `Attach files`\n\nThe following permissions will be required in the future, so better add them now\n(basic functionality will work event without them):\n\n- `Manage messages`\n- `Read message history`\n- `Create events`\n- `Manage events`\n\n### Events and embeds\n\nIf the bot is running in public content mode,\nit cannot access post details like events or previews of the included links.\nBot tries to overcome this by searching for links in the post's text\nand at least trying to make an embed out of them (using a Discord's mechanisms).\nTo access the posts, the page needs to be authorized by some of its admins logging in\nor by using a system user of the portfolio.\n`page_events` permission is most probably required.\n\n### Removing access to your pages\n\nTo remove the access you granted this app to some of your pages,\ndo the according action in Facebook admin panel and just invalidate tokens.\nIf the bot runs in public content mode, make your page private,\notherwise the bot will get your page anyway.\nIf you logged in using Business login,\nauthenticate again and in the list of pages, the bot can manage select none.\nIf you use system user token, revoke tokens of the system user.\n\n## Own deployment and Authorization\n\nThe server is configured using environment variables.\nAll the variables have to be set.\nSee `env_example` with configuration example.\n\n### Facebook Graph API\n\nHead to [Facebook developer page](https://developers.facebook.com),\ncreate a **business** Facebook app and fill in basic information.\nThere are three options for how to set up Facebook app permissions:\n\n#### Page Public Content Access\n\nThe easiest way to set up the bot is to\nobtain [Page Public Content Access](https://developers.facebook.com/docs/features-reference/page-public-content-access)\nfeature.\nApp review and business verification is needed for this feature,\nyou should be able to pass it quite easily.\nWith this permission, you can access any public page and bring it over to Discord\n\n#### Pages of a logged-in user\n\nAdd business (not user) login feature to your app and fill in related settings.\nApp review, business verification and tech provider verification (hard to get) is needed for this feature.\nThen, if a user logs into your app, you can access all the pages he has access to.\nYou can access pages where one of the app's developers/testers is admin without verification.\nTherefore, to bypass app review and business verification, you need to become admin of the page or\none of the admins needs to become your app tester.\nThis app shows the auth link (if the module is set up) at startup, send this link to users to log in.\nRequired permissions are `pages_show_list`, `page_events` and `pages_read_engagement`.\n\n#### Pages of a business portfolio\n\nThis option is similar to the previous one. In your [Meta Business Suit](https://business.facebook.com/latest),\nhead into the system users section. Make sure that your portfolio manages the given pages.\nCreate a new system user, give it permissions for the bot and pages.\nThen click the bot, give it the same permissions as in the approach above and pass the token to this server.\n\n### Discord bot\n\nCreate a Discord bot. Send an invitation to a Discord admin with the following permissions:\n\n- **TODO**\n\n### Setup\n\nOnce you have a Discord bot and FB app created, build a Docker image\nfrom this repository and run it with environment variables according\nto `.env_example`. All the fields from this category are required as I'm lazy to set defaults.\n\n### Management\n\nThe management is handled using three simple endpoints.\nYou can also edit the database directly as the schema is really simple.\nAll the `/admin` endpoints are secured by the access token set in your environment variables.\nPass it as a URL param `access_token=YOUR_TOKEN`.\n\n- `POST /admin/:channel_id/:page_id` - Link the page to the channel\n- `DELETE /admin/:channel_id/:page_id` - Unlink the page to the channel\n- `GET /admin/status` - Lists authorized pages and channels they are linked to.\n\nI recommend using cURL or Postman for this.\n\n### Docker Compose\n\nWe provide an example Docker Compose file below:\n\n```docker-compose\nservices:\n  bot:\n    build: https://github.com/Lastaapps/fb-pages-discrod-bot.git#main\n    restart: always\n    env_file:\n      - env\n    ports:\n      - 127.0.0.1:8080:8080\n    volumes:\n      - ./storage:/storage:rw\n```\n\n```env\nFB_DC_API_SERVER_HOST=localhost\nFB_DC_API_SERVER_PORT=8080\nFB_DC_API_DATABASE_FILENAME=/storage/database.db\n...\n```\n\n## Scraping (deprecated)\n\nIn this mode the app scrapes data from the `mbasic.facebook.com` Facebook frontend.\nThis mode is no longer supported nor maintained, but it may still work.\nA fake account that will probably get banned quite quickly is needed.\n\n### Deployment\n\nConfiguration is done using environment variables,\nsee `env_example` in git history.\nFirst, you need to create a bot account and\nset up the account's translation options\nhttps://m.facebook.com/settings/language/auto_translate_disabled_dialects/\n\nAfter that, create a Discord bot, get the token and add the bot to the desired server.\n\nThen set up your environment variables according to `.evn_example`.\nLog into your account, take the cookie you got, take the desired fields (url decode them).\nAfter that, specify bot's Discord token, channel ID to post the posts into,\ndelay how ofter a full scan will happen and weight of your mum.\n*Don't use your main account as it may get banned.*\n\n#### Race Conditions\n\nIt may happen that if a post is at the time of server startup\npublished n hours ago,\nsome other posts may be skipped from being posted/posted twice.\nTo minimize the chance of this happening, start the bot during the weekend.\n\n## Development\n\nI recommend EnvFile plugin for developing this project.\n\n## License\n\nThe app is licensed under the `GNU GPL v3.0` license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flastaapps%2Ffb-pages-discord-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flastaapps%2Ffb-pages-discord-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flastaapps%2Ffb-pages-discord-bot/lists"}