{"id":22680130,"url":"https://github.com/coderooz/automate-posting-app","last_synced_at":"2025-03-29T13:43:14.491Z","repository":{"id":250681775,"uuid":"835147545","full_name":"coderooz/automate-posting-app","owner":"coderooz","description":"This is a project that aims to automate posting on to the social media sites through a dedicated program.","archived":false,"fork":false,"pushed_at":"2024-08-07T14:56:37.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T14:36:07.772Z","etag":null,"topics":["automation","facebook-api","facebook-sdk","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderooz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-29T08:57:50.000Z","updated_at":"2024-08-07T14:56:41.000Z","dependencies_parsed_at":"2025-02-04T14:37:31.809Z","dependency_job_id":"77f93039-7aef-42b4-bc37-1bc742c32489","html_url":"https://github.com/coderooz/automate-posting-app","commit_stats":null,"previous_names":["coderooz/automate-posting-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fautomate-posting-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fautomate-posting-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fautomate-posting-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2Fautomate-posting-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderooz","download_url":"https://codeload.github.com/coderooz/automate-posting-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246193156,"owners_count":20738450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","facebook-api","facebook-sdk","python"],"created_at":"2024-12-09T19:12:29.009Z","updated_at":"2025-03-29T13:43:14.461Z","avatar_url":"https://github.com/coderooz.png","language":"Python","readme":"# Automated Social Media Posting Program (Under-Work)\n\n## Overview\nThis program automates posting images, documents, and texts across Facebook, Instagram, and WhatsApp.\n\n## Installation\n1. Clone the repository.\n2. Install dependencies: `pip install -r requirements.txt`\n\n## Usage\n- Update `config.py` with your credentials.\n- Run `main.py` to start posting.\n\n\n## Facebook API Wrapper\n\nThis class provides methods to interact with the Facebook Graph API. You can use it to post text, images, and videos to Facebook pages or personal accounts, and to edit existing posts.\n\n## Requirements\n\n- `requests` library: Make sure to install it using `pip install requests`.\n- A valid Facebook access token with the required permissions.\n\n## Class: `Facebook`\n\n### Constructor\n\n```python\n__init__(self, access_token: str)\n```\n\n**Parameters:**\n\n- `access_token` (str): Your Facebook Graph API access token.\n\n**Description:**\n\nInitializes the `Facebook` class and sets up the API client. Fetches the user's details and a list of pages that the user has access to.\n\n### Method: `_requester`\n\n```python\n_requester(self, url: str, method: str = 'get', params: dict = {}, files: dict = {}, new_access_token: str = '')\n```\n\n**Parameters:**\n\n- `url` (str): The URL for the API request.\n- `method` (str): The HTTP method to use (`get`, `post`, `delete`). Default is `get`.\n- `params` (dict): Parameters to include in the request.\n- `files` (dict): Files to upload (e.g., images or videos).\n- `new_access_token` (str): A new access token to use for this request. If not provided, the class's default token is used.\n\n**Returns:**\n\n- `dict`: The response from the API or an error message.\n\n**Description:**\n\nHandles API requests with error handling.\n\n### Method: `post_text`\n\n```python\npost_text(self, page_id: str, message: str)\n```\n\n**Parameters:**\n\n- `page_id` (str): The page ID or 'me' for personal account.\n- `message` (str): The message content to post.\n\n**Returns:**\n\n- `dict`: The API response, including the result of the post operation.\n\n**Description:**\n\nPosts text to a specified page or personal account. If `page_id` is 'me', it posts to the authenticated user's account.\n\n### Method: `edit_post`\n\n```python\nedit_post(self, post_id: str, message: str)\n```\n\n**Parameters:**\n\n- `post_id` (str): The ID of the post to edit.\n- `message` (str): The new message content.\n\n**Returns:**\n\n- `dict`: The API response, including the result of the edit operation.\n\n**Description:**\n\nEdits an existing post on a page or personal account. \n\n### Method: `get_pages_list`\n\n```python\nget_pages_list(self) -\u003e list\n```\n\n**Returns:**\n\n- `list`: A list of pages that the user has access to.\n\n**Description:**\n\nFetches the list of pages that the authenticated user has access to.\n\n## Example Usage\n\n```python\n# Instantiate the Facebook class with your access token\nfba = Facebook('YOUR_ACCESS_TOKEN')\n\n# Post text to a page or personal account\nresponse = fba.post_text('PAGE_NAME', 'Hello, world!\\nThis is an automated post generated by the python script.')\nprint(response)\n\n# Edit a post\npost_id = 'YOUR_POST_ID'\nnew_message = 'This is the updated content of the post.'\nedit_response = fba.edit_post(post_id, new_message)\nprint(edit_response)\n```\n\n## Notes\n\n- Ensure that your access token has the `pages_manage_posts` permission to edit posts on pages.\n- Verify that the `post_id` is correct and that the post belongs to the authenticated user or the page specified.\n\n## Troubleshooting\n\n- **403 Forbidden Error**: This may occur if the access token does not have the required permissions or if the post ID is incorrect.\n- **401 Unauthorized Error**: Check if your access token is valid and has not expired.\n\n\n\n## Contribution\nFeel free to submit pull requests or open issues.\n\n## License\n[MIT License](LICENSE)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderooz%2Fautomate-posting-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderooz%2Fautomate-posting-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderooz%2Fautomate-posting-app/lists"}