1.9 KiB
1.9 KiB
Social milestone worker
The app detects QR-code scan milestones and stores customer consent. It does not hold X or LinkedIn credentials. An external X worker can use the internal queue after the test rollout is approved.
Test setup (manual SQL only)
- Apply
sql/2026-08-13_social_milestones.sqltoqrmaster_test. - Set distinct
CRON_SECRETandINTERNAL_API_SECRETvalues in.env.test. For an end-to-end test without 1,000 scans, also setSOCIAL_MILESTONE_THRESHOLDS=1(or1,2). Do not set this on production. Publishing is immediate after consent by default. SetSOCIAL_MILESTONE_POST_DELAY_HOURS=24only if a revocation window is desired. - Deploy using the documented test compose command.
CRON_SECRETis forwarded to the web service bydocker-compose.yml. - Trigger detection manually:
curl -H "Authorization: Bearer $CRON_SECRET" \
https://testmodul.qrmaster.net/api/cron/social-milestones
The detector creates records at 1,000 and 10,000 unique scans only. It is safe
to call repeatedly because (qrId, kind) is unique.
X worker contract
After an explicit rollout approval, the existing QRMaster X worker may poll:
curl -H "Authorization: Bearer $INTERNAL_API_SECRET" \
https://qrmaster.net/api/internal/social-milestones
It receives at most one approved item per 24 hours. The worker must post milestone.text
without altering it, then report its result:
curl -X PATCH -H "Authorization: Bearer $INTERNAL_API_SECRET" \
-H "Content-Type: application/json" \
-d '{"id":"<milestone-id>","result":"posted"}' \
https://qrmaster.net/api/internal/social-milestones
Do not configure this worker against testmodul. LinkedIn has no approved
brand-posting integration in this project. Customers can self-share: X opens a
prefilled intent; the same text is copied for a LinkedIn post.