OnlyFans Auto Reply Bot
An OnlyFans auto reply bot is a tight loop: an inbound DM arrives, you read enough context to answer, you pick a reply — a canned rule, an away message, or a model completion — and you send it. ofapis gives you the message.received webhook for the trigger and plain REST for the read and the send, so the logic in the middle is entirely yours.
The loop
message.received webhook
│ (verify HMAC, 200 fast, enqueue)
▼
GET /accounts/{id}/chats/{chatId}/messages ← recent context
▼
rule match / away-hours / LLM ← decide
▼
POST /accounts/{id}/chats/{chatId}/messages ← reply (1 credit)
Base URL: https://api.ofapis.com/api/public/v1.
1. Catch the message
Subscribe an HTTPS endpoint to message.received in the dashboard. Every delivery is signed, so verify the X-Ofapis-Signature HMAC against the raw body before doing anything, then return 200 immediately and process in a background job — never block the webhook on model latency. Deduplicate on the event id; delivery is at-least-once. Full contract is on the webhooks page.
2. Decide the reply
Auto-reply bots usually run a rule ladder before falling back to a model:
- Away hours — outside business hours, send a "back at 9am" message.
- Keyword rules — "price?", "menu", "custom" map to fixed responses.
- First-touch — a brand-new thread gets an intro.
- Fallback — anything unmatched goes to your chatbot logic or an LLM with the last few turns as context.
Pull that context cheaply:
curl "https://api.ofapis.com/api/public/v1/accounts/42/chats/456/messages?limit=15" \
-H "Authorization: Bearer ofapis_sk_..."
3. Send it
curl -X POST https://api.ofapis.com/api/public/v1/accounts/42/chats/456/messages \
-H "Authorization: Bearer ofapis_sk_..." -H "Content-Type: application/json" \
-d '{"text":"hey! I reply to every message here — what are you after? 😊"}'
A 200 means delivered and one credit spent. Expired-session or upstream failures aren't charged, so a retrying bot stays cost-safe.
Build outline
- Webhook receiver — verify signature, dedupe on
id, enqueue, ack200. - Rule engine — ordered matchers (away → keyword → first-touch → fallback).
- Context fetch — read the last ~15 messages only when the rule needs them.
- Sender —
POST .../messages; log the outbound for auditing. - Handoff flag — high-value or "talk to a human" intents skip auto-send and route to a chatter.
Gotchas
- Don't auto-reply to yourself. Skip events where the sender is the creator, or you'll build an echo loop.
- Loop guard. Rate-limit replies per fan so a misbehaving rule can't spam one thread.
- Draft mode. Many teams run reply-suggested-then-approved; the only change is whether step 4 auto-fires.
FAQ
Should the bot use webhooks or polling?
Webhooks. Polling GET /chats spends a credit on every empty check and adds latency equal to the interval. message.received pushes only real inbound DMs, so the bot reacts instantly and cheaply.
How do I stop the bot replying to its own messages?
Check the sender in the webhook payload and ignore events originating from the creator account. Without that guard, each auto-reply can retrigger the loop.
Can I mix canned rules with an LLM?
Yes. Run an ordered rule ladder first (away hours, keywords, first-touch) and fall through to a model only when nothing matches. The send step is identical either way — it's just POST .../messages.
How is the bot billed?
One credit per successful reply sent. Inbound webhook deliveries are free, and failed sends aren't charged, so cost tracks replies actually delivered. See pricing.
Start free · Automate OnlyFans DMs · Messaging API
Related: OnlyFans automation guide