This repository has been archived on 2025-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
Files
fbchat/examples/basic_usage.py
Mads Marquart 78949e8ad5 Update examples
Only `import fbchat`, and update to initialize Client using Session
2020-01-08 10:45:41 +01:00

20 lines
383 B
Python

import fbchat
# Log the user in
session = fbchat.Session.login("<email>", "<password>")
print("Own id: {}".format(sesion.user_id))
# Create helper client class
client = fbchat.Client(session)
# Send a message to yourself
client.send(
fbchat.Message(text="Hi me!"),
thread_id=session.user_id,
thread_type=fbchat.ThreadType.USER,
)
# Log the user out
session.logout()