harshil

loop

When someone comments a keyword on an Instagram post, loop sends them a DM with the link.

prototypeGo2026-06 → 2026-07solo, with AI agentsgithub ↗

what
A tool for creators. "Comment LINK and I will DM you" - loop sends those DMs automatically.
the hard part
Many comments can arrive at once, each account has a sending limit, and no DM may be lost if a server restarts.
where it is
Prototype.

How it works

  1. Instagram tells loop about each new comment (webhook — An HTTP request that another service sends to your server when something happens, for example "a payment succeeded".).
  2. If the comment matches a rule, loop writes a “send this DM” job into a database table.
  3. Workers take jobs from that table, send the DM, and reply “Sent you a DM 📩” under the comment.

Design choices

  • The database table is the queue (outbox pattern — Write the job to a database table first, then let workers send it. A crash does not lose the job: the workers continue from the table.). If a server crashes, the jobs are still in the table, and the workers continue where they stopped. Two workers never take the same job (FOR UPDATE SKIP LOCKED).
  • Time limits on every step: 30 seconds for a whole job, 10 for the DM, 8 for the public reply.
  • The API description comes first. The dashboard is generated from it, and works with a fake server while the real one is off.

explore the code

Explorer 5 parts · tap one
server/internal/webhook/

Receives a message from Instagram for every new comment. source ↗

server/internal/rules/

Which words trigger which message and link. source ↗

server/internal/outbox/

The workers that send the DMs within each account's limit, and retry when a send fails. source ↗

server/internal/ratelimit/

The speed limit per account. source ↗

contract/openapi.yaml

The API description. The dashboard's code is generated from it. source ↗

keys

This page reads like any web page. If you use vim, it also works like vim.

move
j / knext / previous line
gg / Gtop / bottom
Ctrl-d / Ctrl-uhalf a page down / up
]] / [[next / previous heading
H / Lprevious / next project or post
act
Enter or gfopen the link on the current line
Kexplain the term on the current line
/ then n / Nsearch this page
:command line: a page name, help, q
Spacemenu: f find, p projects, w writing
Space a / Ctrl-e / Alt-1…4pin a page, list pins, jump to a pin
Ctrl-oback
Escclose, clear search