Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
feat(automations): mark followers-only rules as in testing
spacesdrive14bf27a62312
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 098107c..810e8cd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -17,7 +17,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).- An audit record of connecting, reconnecting and removing accounts and of every automation change, kept a year (#89)- Every migration now holds one database entity (a table, its access, a trigger, an index or a function) with a rollback of the same size, and the migration test enforces it for new migrations (#93, ADR-041)- Automation rules can answer any comment, with no keyword; the most specific rule answers, so a comment still gets one reply (#102)-- Followers-only rules: the first reply asks the person to follow and reply, and the link goes out only when Instagram confirms they follow; nothing is sent when Instagram cannot say (#103, ADR-043)+- Followers-only rules, in testing and not yet tried with a real account: the first reply asks the person to follow and reply, and the link goes out only when Instagram confirms they follow; nothing is sent when Instagram cannot say (#103, #105, ADR-043)- A new every-minute cron trigger dispatches waiting replies and follow-ups, and the five minute runs off the quarter hour expire overdue replies, look for replies whose answer was lost in the conversation on Instagram, and log the queue's health (#99, #100, ADR-043)- New table `automation_followups` and new columns and functions for the reply queue; existing instances run `npm run db:push` before deploying (#99, #100, #102, #103)diff --git a/docs/architecture/data-flows/AUTOMATION.md b/docs/architecture/data-flows/AUTOMATION.mdindex 1d8c879..1bffe64 100644--- a/docs/architecture/data-flows/AUTOMATION.md+++ b/docs/architecture/data-flows/AUTOMATION.md@@ -131,6 +131,8 @@ A wait that would end after the 7 day window makes the comment `expired` instead## Followers-Only Replies (`backend/services/automationFollowupProcessor.ts`)+**Status: in testing.** The flow is covered by tests with fakes and a local database, but it has not been tried with a real account. It depends on Meta sending the account's `messages` events, which may need Advanced Access for `instagram_business_manage_messages`; this instance runs on Standard Access. The app and the docs label it as testing, and it may or may not work.+Instagram does not let an app check whether a commenter follows the account until that person messages it, so the check cannot happen before the first private reply. A followers-only rule therefore works in two steps, and Twiligent never says a follow was checked when it was not.1. **The private reply** sends the rule's first message (`follow_prompt_text`), with no link: for example "Follow this account, then reply to this message and the link is on its way." Once Instagram accepts it, the comment waits for the person's answer.diff --git a/frontend/src/features/automations/AutomationRules.tsx b/frontend/src/features/automations/AutomationRules.tsxindex b549ee3..b47f822 100644--- a/frontend/src/features/automations/AutomationRules.tsx+++ b/frontend/src/features/automations/AutomationRules.tsx@@ -40,7 +40,7 @@ function RuleRow({ rule, username, busy, automations, onEdit, onDelete }: RuleRo{rule.matchMode === 'any'? <Badge variant="warning">Any comment</Badge>: rule.keywords.map(keyword => <Badge key={keyword} variant="secondary">{keyword}</Badge>)}- {rule.requireFollow && <Badge variant="info">Followers only</Badge>}+ {rule.requireFollow && <Badge variant="info">Followers only, testing</Badge>}</div><p className="text-small text-ink-muted">{matchModeLabel(rule)} · {ruleScopeLabel(rule)}{rule.hourlyLimit ? ` · at most ${rule.hourlyLimit} an hour` : ''}diff --git a/frontend/src/features/automations/RuleDialog.tsx b/frontend/src/features/automations/RuleDialog.tsxindex 90b9d32..1809d74 100644--- a/frontend/src/features/automations/RuleDialog.tsx+++ b/frontend/src/features/automations/RuleDialog.tsx@@ -1,5 +1,6 @@import { Megaphone, UserCheck } from 'lucide-react';import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';+import { Badge } from '@/components/ui/badge';import { Button } from '@/components/ui/button';import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';import { Input } from '@/components/ui/input';@@ -93,7 +94,10 @@ export default function RuleDialog({ rule, igAccounts }: RuleDialogProps) {</FieldRow><div className="flex flex-col gap-3 rounded-card border border-line p-4"><label htmlFor="rule-follow" className="flex items-center justify-between gap-3 text-sm font-medium text-ink">- <span className="flex items-center gap-2"><UserCheck className="size-4 text-ink-muted" />Send the link only to followers</span>+ <span className="flex items-center gap-2">+ <UserCheck className="size-4 text-ink-muted" />Send the link only to followers+ <Badge variant="warning">Testing</Badge>+ </span><Switch id="rule-follow" checked={form.requireFollow} onCheckedChange={checked => setField('requireFollow', checked)} /></label><p className="text-small text-ink-muted">@@ -101,6 +105,10 @@ export default function RuleDialog({ rule, igAccounts }: RuleDialogProps) {to follow and reply. When they reply, Twiligent asks Instagram, then sends the reply and link to followers and a reminder toeveryone else, twice at most. If Instagram cannot say, nothing is sent.</p>+ <p className="text-small text-warning">+ This option is still being tested and may or may not work. It needs Instagram to send your account's messages to+ Twiligent, which Meta may not allow without extra app approval. Use a keyword rule when the link must arrive.+ </p>{form.requireFollow && (<><FieldRow label="First reply" htmlFor="rule-follow-prompt" hint="Sent to everyone who comments. It has no link.">diff --git a/site/content/docs/self-host/comment-automation.mdx b/site/content/docs/self-host/comment-automation.mdxindex 9a9814c..debca3c 100644--- a/site/content/docs/self-host/comment-automation.mdx+++ b/site/content/docs/self-host/comment-automation.mdx@@ -45,7 +45,7 @@ Open the app, **Instagram**, **API setup with Instagram business login**, **ConfChoose **Verify and save**. Meta calls the URL once; if it fails, check that the backend is deployed and the secret is set. Then subscribe to the **comments** field.-Subscribe to the **messages** field too only if you will use followers-only rules. Meta then sends every direct message to your connected accounts to the backend, each one a Worker request. Twiligent reads only who sent it, never the text, and answers only people a followers-only reply is waiting for.+Subscribe to the **messages** field too only if you will use followers-only rules. That option is still in testing and may or may not work: without Advanced Access for `instagram_business_manage_messages`, Meta may not send the messages. Meta then sends every direct message to your connected accounts to the backend, each one a Worker request. Twiligent reads only who sent it, never the text, and answers only people a followers-only reply is waiting for.</Step><Step title="Turn on comment events for each account">diff --git a/site/content/docs/use/automations.mdx b/site/content/docs/use/automations.mdxindex ac8b01b..43b1ac3 100644--- a/site/content/docs/use/automations.mdx+++ b/site/content/docs/use/automations.mdx@@ -26,7 +26,13 @@ An any-comment rule messages everyone who comments, including people who did not</Callout>-## Send the link only to followers+## Send the link only to followers (testing)++<Callout type="warning" title="In testing">++This option is still being tested and may or may not work. It needs Instagram to send your account's direct messages to Twiligent, which Meta may not allow without extra approval for the app. If the link must arrive, use a keyword rule instead.++</Callout>Turn on **Send the link only to followers** to keep the link for people who follow you. Instagram lets Twiligent check whether someone follows you only after that person has messaged you, so the rule works in two steps: