# Facebook Page Poster

A simple Python script to post messages to a Facebook page using the Facebook Graph API.

## Prerequisites

1. A Facebook Developer account and a Facebook App.
2. Page Access Token with `pages_manage_posts` permission.
3. The Page ID of the Facebook page you want to post to.

## Setup

1. Install the required dependencies:
   ```
   pip install -r requirements.txt
   ```

2. Edit `fb_post.py` and replace the placeholder values:
   - `ACCESS_TOKEN`: Your Page Access Token
   - `PAGE_ID`: The ID of your Facebook page
   - `MESSAGE`: The message you want to post

## How to Get Access Token and Page ID

1. **Create a Facebook App**: Go to [Facebook Developers](https://developers.facebook.com/) and create a new app.

2. **Get Page Access Token**:
   - Go to your app's dashboard
   - Use the Graph API Explorer
   - Select your app and page
   - Generate a token with `pages_manage_posts` permission

3. **Get Page ID**:
   - Visit your Facebook page
   - The Page ID is in the URL (e.g., `https://www.facebook.com/yourpage-1234567890` - the number is the ID)
   - Or use the Graph API: `GET /me/accounts` to list pages and their IDs

## Usage

Run the script:
```
python fb_post.py
```

The script will attempt to post the message and print the result.

## Notes

- Make sure your access token is valid and has the necessary permissions.
- The script posts text messages. For images or other media, additional modifications are needed.
- Handle your access tokens securely - don't commit them to version control.