Introduction
Friends, greetings!
I once told you about the serviceinstant cleaning comments AFP.Monster, the main feature of which is the ability to process comments INSTANTLY, as soon as they are left under your posts. Now I’ll show you how it all works under the hood, and at the same time I’ll give you a free analogueAFP.Monster.
DISCLAIMER
- This is a technically complex article, there is a lot of small fuss that it is advisable to understand. And although I tried to convey everything as clearly as possible, you may not succeed, keep in mind.
- do all the operations described below ONLY if you need some kind of custom, or you have little money, or you are just curious. In all other cases you shouldignore all this and use AFP.Monster. Everything there is done for people, and you can focus on the funnel, not on the technical stuff.
- The application that we will set up will only work for one Facebook account. New account? You will have to do everything from the very beginning. Yes, you can try to automate this, no questions asked. But in general, I recommend using this method on FPshek storage accounts. This way you can quickly receive tokens from FPS and connect them to the system.
Now let’s go!
What do we need?
Any domain withhostingwhere you can throw itthese are the PHP files, with PHP version 8.2 and higher. WITHhostingMust have access to Facebook! Those.Begetthis time will not work, use, for example,FriendHosting. You also need an SSL certificate, i.e. for https to work.
WebHooks
So, the main feature with which instant cleaning is possible is webhooks, i.e. in essence, notifications about events that have occurred. Fabe can kindly notify our script that a new comment has appeared on the ad. Well, why?
Let’s create an application that will use this feature.How to create an app is described in this articlein the section «Application registration“, and I’ll start from the step when everything is already registered and created.
In order for our application to receive real data from Facebook, we need to switch it to Live mode.

A window will appear warning you that before you enable Live mode, you need to specify the privacy policy URL. I provide it along with the script in the policy.html file. If, suddenly, it stops rolling, generate any other policy.

I also indicate this policy in the Terms of Service field.

Now we need to get a token in order to be able to add fps to the software on which we want to process comments. To do this, go to the top menu Tools — Graph Api Explorer.
Select our app from the Meta App drop-down menu. In the User or Page menu — set User or Get Token. And in the lower Permissions menu, select all permissions starting with pages_manage, pages_read and pages_show_list.

After that, click the big blue Generate Access Token button.

A separate window will appear where we select the item with accessto all current and future pages.

We complete this quest to the end and return to our Graph Explorer.
So we have a token! But it has a very short lifespan, we need to extend it so that it works for several months and doesn’t blow our minds! To renew, copy the token, then go to Tools — Access Token Debugger and push the token there.

We see that the token has all the necessary rights, and also thatthe token will die in an hour. Therefore, scroll to the very bottom and click on the Extend Access Token button.

You will be asked for a password and given a new token with a lifetime of 2 months.

Let’s keep it for ourselves (we will add it to our software).
IIIIIII, that’s ALL with the settings inside Facebook, phew!
Setting up the system itself
First of all, you need to open the settings.php file for editing and change there:
- admin password from qwerty to something more suitable
- the name of the database with comments.db to something longer and less obvious. This database will store tokens from FPS, so it is undesirable for someone to be able to pump it out. 20-25 characters in the title will be normal.
- It is advisable to enable debugging mode, i.e. $debug = true; Then, in case of errors or successful actions, the system will show additional messages. After everything is configured, this mode can be turned off: $debug = false;
Next, go to index.php and log in to the admin area using the preset password. We see the following interface:

At the top there is a button for viewing logs and logging out, on the left there is a menu with Applications, Pages, Cleaning and Auto Reply.
First we need to add the application that we created in Facebook Developers. For this you will needtoken from the APPLICATION. The easiest way to get it is in the same Graph API Explorer by selecting our app and putting in the App Token, as in the screenshot.

Did you receive it? Great, add it to the software using the Add App and Subscribe button.

Next, go to the Pages page and insert ourUser token, which we created and extended in the previous steps. Then click Fetch.

Select and add the pages you need. Go to the Cleaner item and enable comments processing. There you can also select the operating mode: delete or hide, plus it is possible to delete ALL page content, that is, all posts and photos. Works well for older pages»with history«, which need to be converted to new offers.

In the Replies item, you can write a comma-separated list of words, in response to which an auto-reply with the required text and, if necessary, a picture will be published on behalf of the FP.

Use it to your health, and for today I have everything for you, pour it into the plus, gentlemen!
P.S. And once again: I strongly recommend that before you start tinkering with the script,CHECK OUT THE AFP.Monster SERVICE, all this is ALREADY there, and you don’t need to configure anything.
P.P.S. If something doesn’t work out for you, look at the LOGS, in the logs folder or directly in the interface by clicking the LogViewer button in the upper right corner. And now with the logs, you can try knocking on my PM.


спасибо за софт, но не могу зайти на index.php http error 500 ошибка, попробовал зайти на login.php Там все ок но дальше кидает на admin.php и там тоже ошибка 500, можешь подсказать пж что не так сделал, там вроде ошибиться нельзя было при заливе файлов на хост 😅
Для начала можно включить debug=true в settings.php и посмотреть реальную ошибку, что напишет. Если не удастся решить — пиши в тг @dvygolov
спасибо за подсказку, у меня был не установлен SQLite3 на сервере поэтому все падало, установил и все заработало спасибо большое
отлично, рад слышать!
и можешь пожалуйста подсказать по каким правилам фильтруются коммментарии? всмысле удаление/скрытие происходит исходя из каких слов? их нужно где-то задавать самому или уже есть база в файлах?
нет никаких правил, удаляются/скрываются абсолютно ВСЕ комментарии, если только в комментарии нету триггерных слов. Если слова найдены — то публикуется ответ от имени фп и коммент остаётся.
Спасибо за софт! Установил всё на выделенный сервер, сделал всё как в статье, установил нужные библиотеки php, sqlite на сервер.
Но не удаляются комментарии. При включённом логированнии, в Log Viewer падает информация [11:27:26] [Info] Got New Comment: {…
Но больше ничего не пишет, ни ошибок доступа, ни ошибок FBAPI. Просто чисто страница только с событиями Got New Comment.
Есть какие-то предположения/советы, что может помочь?
напишите мне в тг @dvygolov и скиньте лог-файл сам, посмотрим, что у вас там
указываю ссылку и токен и выдает следующую ошибку. в чем может быть дело?
The callback URL or verify token couldn’t be validated. Please verify the provided information or try again later.
а сам по ссылке переходить пробовал, ссылка рабочая?
по ссылке index.php не открывается «HTTP ERROR 500»
в терминале ввожу sudo php -f /var/www/html/comments/index.php и выдает следующую ошибку
«No entry for terminal type «unknown»;
using dumb terminal settings.
PHP Parse error: syntax error, unexpected ‘.’, expecting ‘,’ or ‘;’ in /var/www/html/comments/logger.php on line 5″
Какая у вас версия PHP на сервере?
PHP 5.4.16
А нужна от 7.4 или выше
обновл php до 8.2, по ссылки index.php по прежнему не открывается «HTTP ERROR 500».
закидывал тестовый пхп (?php
header(‘Content-Type: text/html; charset=UTF-8’);
echo ‘WORKS!’;) он открывается по ссылке.
другие же php файлы из архива не открываются (policy.html открывается по ссылке).
все права выданы корректно, уже хз что еще нужно
поставьте 7.4
Все заработало, большое спасибо за терпение и ответы
AFP.Monster здох сервис или еще будет работать? Может есть какая-то информация? Уже месяц не удаляєт коментарии (
вроде работал, уточню и вернусь
уточнил — всё работает
Почему то, софт ловит комментарии в логе (12:35:04] [Info] Got New Comment:) , но не скрывает/удаляет.
на вкладке Cleaner у нужной фп включите, собственно очистку, тумблер перещёлкните
обновил php до 8.2 и выдает следующую ошибку
Warning: mkdir(): Permission denied in /var/www/html/comnew/logger.php on line 10
Warning: file_put_contents(/var/www/html/comnew/logs/2025-10-11.log): Failed to open stream: No such file or directory in /var/www/html/comnew/logger.php on line 33
[10:00:49] [Error] An error occurred: Unable to open database: unable to open database file
прав на запись нет в папку, раздай на свой comnew права, типа chmod 777 comnew
пофиксил, работает, спасибо.
Но почему то не хочет добавлять приложение «Failed to subscribe app. Please check the app token.» токен приложения полностью копирую и ошибка. создал новое приложение с вебхуками и аналогичная ошибка
[Error] Facebook API error in method ‘subscribe_app’: (#2200) Callback verification failed with the following errors: HTTP Status Code = 404; HTTP Message = Not Found (Type: OAuthException, Code: 2200)
Домен привязан? сертификат для https добавлен?
«Домен привязан? сертификат для https добавлен?»
да, привязан и ссл стоит. я пользовался прошлой версией твоего софта, просто обновил php до 8.2