Welcome to the Facebook Post Moderator template! This template is designed to help you moderate comments on your Facebook page feed using the Facebook API and webhooks. It utilizes FastAPI to create a webhook endpoint that automatically moderates posts on your page, flagging or removing any inappropriate comments. Before you begin, ensure you have admin access to the Facebook page you wish to moderate, as you will need this to obtain the necessary access token.
To begin using this template, click on "Start with this Template" in the Lazy builder interface. This will pre-populate the code in the Lazy Builder, so you won't need to copy or paste any code manually.
Before testing the template, you'll need to set up an environment secret for the PAGE_ACCESS_TOKEN. Here's how to obtain and set up your PAGE_ACCESS_TOKEN:
Once you have set up your environment secret, press the "Test" button in the Lazy builder interface. This will begin the deployment of the app and launch the Lazy CLI.
After pressing the "Test" button, Lazy will handle the deployment of your application. You will be provided with a dedicated server link to use the API. Since this template uses FastAPI, you will also receive a link to the API documentation, which you can use to interact with your new Facebook Post Moderator app.
To integrate the Facebook Post Moderator into your Facebook page, you will need to set up a webhook in your Facebook app settings:
Now, your Facebook Post Moderator app will receive webhook events whenever there is activity on your page, and it will automatically moderate comments based on the logic you've set up.
Remember, you don't need to worry about installing libraries or setting up your environment. Lazy handles all of that for you, so you can focus on building your application.
Here's a sample request you might send to your app's API:
POST /webhook/ HTTP/1.1
Host: your-lazy-app-url.com
Content-Type: application/json
{
"object": "page",
"entry": [
{
"id": "page-id",
"time": 1234567890,
"messaging": [
{
"sender": {
"id": "user-id"
},
"recipient": {
"id": "page-id"
},
"timestamp": 1234567890,
"message": {
"mid": "mid.1234567890",
"text": "hello, world!"
}
}
]
}
]
}
And a sample response indicating successful moderation:
{
"message": "Comment moderated successfully."
}
With this template and the Lazy platform, you're now equipped to create a robust comment moderation system for your Facebook page. Happy building!