All Projects → tulir → fbchat-asyncio

tulir / fbchat-asyncio

Licence: BSD-3-Clause license
Facebook Messenger library for Python/Asyncio

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to fbchat-asyncio

Restfb
RestFB is a simple and flexible Facebook Graph API client written in Java.
Stars: ✭ 681 (+1791.67%)
Mutual labels:  facebook-messenger
Messenger Maid Chan
[Deprecated] Maid-chan feat Facebook Messenger bot to accompany personal daily life
Stars: ✭ 59 (+63.89%)
Mutual labels:  facebook-messenger
Magento Chatbot
Magento Chatbot Integration with Telegram, Messenger, Whatsapp, WeChat, Skype and wit.ai.
Stars: ✭ 149 (+313.89%)
Mutual labels:  facebook-messenger
Chatistics
💬 Python scripts to parse Messenger, Hangouts, WhatsApp and Telegram chat logs into DataFrames.
Stars: ✭ 814 (+2161.11%)
Mutual labels:  facebook-messenger
Chatblocks
Declarative Messenger chatbot framework
Stars: ✭ 48 (+33.33%)
Mutual labels:  facebook-messenger
Flow Dashboard
A goal, task & habit tracker + personal dashboard to focus on what matters
Stars: ✭ 1,379 (+3730.56%)
Mutual labels:  facebook-messenger
Messer
💬 Command-line messaging for Facebook Messenger
Stars: ✭ 415 (+1052.78%)
Mutual labels:  facebook-messenger
Forensic Tools
A collection of tools for forensic analysis
Stars: ✭ 204 (+466.67%)
Mutual labels:  facebook-messenger
Jetmessenger
Facebook Messenger clone built with Jetpack Compose
Stars: ✭ 57 (+58.33%)
Mutual labels:  facebook-messenger
Claudia Bot Builder
Create chat bots for Facebook Messenger, Slack, Amazon Alexa, Skype, Telegram, Viber, Line, GroupMe, Kik and Twilio and deploy to AWS Lambda in minutes
Stars: ✭ 1,717 (+4669.44%)
Mutual labels:  facebook-messenger
Fbbotw
Python Wrapper for Facebook Messenger Bot Platform.
Stars: ✭ 15 (-58.33%)
Mutual labels:  facebook-messenger
Fbchat
Facebook Chat (Messenger) for Python
Stars: ✭ 995 (+2663.89%)
Mutual labels:  facebook-messenger
Facebook
📨 Facebook Notifications Channel for Laravel
Stars: ✭ 120 (+233.33%)
Mutual labels:  facebook-messenger
Caprine
Elegant Facebook Messenger desktop app
Stars: ✭ 6,170 (+17038.89%)
Mutual labels:  facebook-messenger
Mautrix Facebook
A Matrix-Facebook Messenger puppeting bridge
Stars: ✭ 172 (+377.78%)
Mutual labels:  facebook-messenger
Fb Messenger Cli
fb-messenger-cli, console Facebook messenger
Stars: ✭ 665 (+1747.22%)
Mutual labels:  facebook-messenger
Facebot
Slackbot for facebook messaging integration in slack
Stars: ✭ 91 (+152.78%)
Mutual labels:  facebook-messenger
Awesome Bots
The most awesome list about bots ⭐️🤖
Stars: ✭ 2,864 (+7855.56%)
Mutual labels:  facebook-messenger
Messenger For Desktop
This is not an official Facebook product, and is not affiliated with, or sponsored or endorsed by, Facebook.
Stars: ✭ 2,180 (+5955.56%)
Mutual labels:  facebook-messenger
Botkit
Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
Stars: ✭ 10,555 (+29219.44%)
Mutual labels:  facebook-messenger

fbchat - Facebook Messenger for Python

Project version Supported python versions: 3.6, 3.7 and 3.8 License: BSD 3-Clause

A powerful and efficient library to interact with Facebook's Messenger, using just your email and password. This is an asyncio fork of the fbchat library.

This is not an official API, Facebook has that over here for chat bots. This library differs by using a normal Facebook account instead.

fbchat currently support:

  • Sending many types of messages, with files, stickers, mentions, etc.
  • Fetching all messages, threads and images in threads.
  • Searching for messages and threads.
  • Creating groups, setting the group emoji, changing nicknames, creating polls, etc.
  • Listening for, an reacting to messages and other events in real-time.
  • Type hints, and it has a modern codebase (e.g. only Python 3.5 and upwards).
  • async/await (COMING).

Essentially, everything you need to make an amazing Facebook bot!

Caveats

fbchat works by imitating what the browser does, and thereby tricking Facebook into thinking it's accessing the website normally.

However, there's a catch! Using this library may not comply with Facebook's Terms Of Service!, so be responsible Facebook citizens! We are not responsible if your account gets banned!

Additionally, the APIs the library is calling is undocumented! In theory, this means that your code could break tomorrow, without the slightest warning! If this happens to you, please report it, so that we can fix it as soon as possible!

With that out of the way, you may go to Read The Docs to see the full documentation!

Installation

$ pip install fbchat-asyncio

If you don't have pip, this guide can guide you through the process.

You can also install directly from source, provided you have pip>=19.0:

$ pip install git+https://github.com/tulir/fbchat-asyncio.git#egg=fbchat

Examples

All examples are available here.

Basic example: basic_usage.py

If login using email and password doesn't work, you can create a file in the working directory called "session.json" with the following format:

{
        "c_user": "[15 digits]",
        "xs": "[variable]"
}

These values are from the cookies stored by your browser after logging in your account. You can get these values this way:

On Firefox:

  1. Open messenger.com, login and press F12
  2. Go to "Storage"
  3. Go to "Cookies"
  4. Select "https://messenger.com" and copy the values from there.

On Chrome:

The process is the same, the only difference is "Storage" is called "Application" in Chrome.

KEEP IN MIND: These values can be used by someone else to login to your account, so keep them private!

After that you can use this code: session_handling.py

Depending on the domain you're logging into, you have to set the "domain" argument appropriately (either facebook.com or messenger.com). Here's an example:

await fbchat.Session.from_cookies(cookies, domain="messenger.com")

Maintainer

Acknowledgements

This project was originally inspired by facebook-chat-api.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].