Skip to content

Instantly share code, notes, and snippets.

@skilldeliver
Created December 25, 2018 16:41
Show Gist options
  • Save skilldeliver/30b178c1f9d07105bfc72790765107f2 to your computer and use it in GitHub Desktop.
Save skilldeliver/30b178c1f9d07105bfc72790765107f2 to your computer and use it in GitHub Desktop.
Send message to all facebook friends
# Special for the SoftUni python group
# Python 3.5 / 3.6 required
# fbchat required
from fbchat import Client
from fbchat.models import *
from getpass import getpass
client = Client('[email protected]', getpass())
users = client.fetchAllUsers()
for user in users:
try:
if user.uid != 0 and user.is_friend:
mess = Message(text="%s, весели празници!" % (user.first_name))
client.send(mess, thread_id=user.uid, thread_type=ThreadType.USER)
except Exception as e:
try:
print('Not sent to %s' % (user.first_name))
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment