forked from LiveCarta/CommentAutomation
Added webhooks subapp for instagram webhooks and celery app and task to pass comment text to an LLM for further processing
This commit is contained in:
40
README.md
40
README.md
@@ -16,3 +16,43 @@ Python project initialized with uv.
|
||||
4. Run tests:
|
||||
|
||||
uv run pytest
|
||||
|
||||
## Webhooks
|
||||
|
||||
Instagram comments webhook endpoint:
|
||||
|
||||
- POST /webhooks/instagram/comments
|
||||
|
||||
The route validates incoming payloads and enqueues a Celery task.
|
||||
|
||||
## LLM task configuration
|
||||
|
||||
The Celery task that handles webhook payload forwarding reads these environment variables:
|
||||
|
||||
- LLM_ENDPOINT_URL (required): Full HTTP(S) URL for the downstream LLM endpoint.
|
||||
- LLM_ENDPOINT_API_KEY (optional): Bearer token sent as Authorization header.
|
||||
- LLM_ENDPOINT_TIMEOUT_SECONDS (optional): Request timeout in seconds. Defaults to 10.
|
||||
|
||||
Retry behavior is built into the task:
|
||||
|
||||
- Retries transient failures (network/timeouts and HTTP 429/500/502/503/504).
|
||||
- Exponential backoff enabled.
|
||||
- Retry delay is jittered.
|
||||
- Maximum retries is 7.
|
||||
|
||||
## Running a Celery worker
|
||||
|
||||
The Celery entrypoint is in src/comment_automation/celery_app.py.
|
||||
|
||||
It reads these environment variables:
|
||||
|
||||
- CELERY_BROKER_URL (optional): Message broker URL. Defaults to redis://localhost:6379/0.
|
||||
- CELERY_RESULT_BACKEND (optional): Result backend URL. Defaults to redis://localhost:6379/0.
|
||||
|
||||
With uv:
|
||||
|
||||
uv run celery -A comment_automation.celery_app:celery_app worker --loglevel=info
|
||||
|
||||
Without uv (venv already created):
|
||||
|
||||
./.venv/bin/celery -A comment_automation.celery_app:celery_app worker --loglevel=info
|
||||
|
||||
Reference in New Issue
Block a user