The post has been translated automatically. Original language: Russian
Hello everyone The AdPayer project team is in touch. We are building an advertising automation platform and we want to share our insight for those who plan to integrate with Meta.
When we started, it seemed like, "Just pull the API handle, get a token, and withdraw the money." Reality: 📉
- Tokens live their own lives. OAuth2 tokens can "go bad" at any time. If you have 50 client accounts, it is not possible to manage this manually. We are writing a separate microservice (Token Refresh Service) that updates accesses in the background so that the client does not see 401 errors.
- Request limits. Facebook bans you harshly if you ask too often "How much money is left?". We have to implement Redis and cache data, updating it no more than once every 15 minutes, but at the same time show the user the current balance.
- Webhooks instead of Polling. In order not to hammer the server with requests, we switched to the architecture of webhooks. Now Meta itself "knocks" on us when the status of an ad changes or a transaction takes place.
We are currently finalizing the billing module in Python (FastAPI + PostgreSQL). If there are those among the residents who are also struggling with the API of advertising networks, let's share our experience!
#Development #Python #API #Meta #AdTech
Всем привет! На связи команда проекта AdPayer. Делаем платформу для автоматизации рекламы и хотим поделиться инсайтом для тех, кто планирует интеграции с Meta.
Когда мы начинали, казалось: «Просто дерни ручку API, получи токен и спиши деньги». Реальность: 📉
- Токены живут своей жизнью. OAuth2 токены могут "протухнуть" в любой момент. Если у вас 50 клиентских аккаунтов, управлять этим вручную невозможно. Мы пишем отдельный микросервис (Token Refresh Service), который в фоне обновляет доступы, чтобы клиент не видел ошибок 401.
- Лимиты запросов. Facebook жестко банит, если вы слишком часто спрашиваете «Сколько денег осталось?». Приходится внедрять Redis и кэшировать данные, обновляя их не чаще раза в 15 минут, но при этом показывать юзеру актуальный баланс.
- Webhooks вместо Polling. Чтобы не долбить сервер запросами, мы перешли на архитектуру вебхуков. Теперь Meta сама "стучится" к нам, когда меняется статус объявления или проходит транзакция.
Сейчас мы финализируем модуль биллинга на Python (FastAPI + PostgreSQL). Если среди резидентов есть те, кто тоже мучается с API рекламных сетей — давайте обмениваться опытом!
#Development #Python #API #Meta #AdTech