Simple Python command line script for checking Facebook page event participants.
dateutil, facepy, requests (required by facepy)
Only user token allows to post events on behalf of the user
App token:
- Go to: https://developers.facebook.com/apps
- Click: "Create New App"
- Provide an app name, then click "Continue"
- Token is available at: https://developers.facebook.com/tools/access_token/
Extended user token (complete above before proceeding):
- Go to: https://developers.facebook.com/tools/explorer
- Select your application and click: "Get Access Token"
- Check: "user_events" (in "User Data Permissions") and "create_event" (in "Extended Permissions")
- Click: "Get Access Token"
This is short-lived token (which expires in about 2 hours). To extend it (to about 2 months) you need facebook-extend-access-token.py script together with the just generated short-lived token, app id and app secret (https://developers.facebook.com/apps):
$ ./facebook-extend-access-token.py --appid 'App ID' --appsecret 'App Secret' --token 'User Token'
For more details, please go to: <https://developers.facebook.com/docs/facebook-login/access-tokens>
All examples assume you have already setup your access token in config.json!
$ ./facebook-event.py -h --id 331218348435 --email test@gmail.com --password testPassword
To run on a schedule, if you're on OSX, run crontab with the below command. If you're on Linux/Ubuntu, cd to your /etc/ and choose one of the approiate directories, like cron.daily, cron.weekly, etc.
$ crontab -e
Once you're editing a crontab, you add the specific time interval(the cron part) and the script you wish to run such as:
0 8 * * 2 {path_to_python}/python3 /facebookEventEmailer/facebook-event.py events --id 331218348435 --email test@gmail.com --password testPassword
After saving and exiting your changes your crontab will be created and running.
The order of cron is minute, hour, day of month, month, day of week(0-6, Sunday = 0). You can read more about cron here: http://www.adminschoice.com/crontab-quick-reference