How to Build an OnlyFans Chatbot
To build an OnlyFans chatbot, treat it as an event loop: receive a message, read the conversation, decide a reply, send it — and route fans into segments as you learn about them. ofapis gives you a signed webhook for the trigger and plain REST calls for the rest, so you can drop any model or ruleset in the middle.
Endpoints you'll use
| Step | Endpoint |
|---|---|
| Get triggered | message.received webhook |
| Read chat history | GET /accounts/{id}/chats/{chatId}/messages |
| Look up the fan | GET /accounts/{id}/users/{targetUserId} |
| Send the reply | POST /accounts/{id}/chats/{chatId}/messages |
| Segment the fan | POST /accounts/{id}/lists/{listId}/users/{targetUserId} |
All paths sit under https://api.ofapis.com/api/public/v1.
1. Receive incoming messages
Subscribe to message.received with a webhook. ofapis signs each delivery with an HMAC secret so you can verify it's genuine before acting. Verify first, then acknowledge fast (return 200) and do the work in a background job — webhook handlers should never block on model latency.
2. Read the conversation
A good reply needs context, so pull recent history rather than answering the single incoming line in isolation:
curl "https://api.ofapis.com/api/public/v1/accounts/42/chats/456/messages?limit=20" \
-H "Authorization: Bearer ofapis_sk_..."
Feed the last few turns to your rules engine or LLM. Because ofapis is OpenAPI-native, you can also let an assistant drive the calls directly — see OnlyFans API for Claude / ChatGPT (MCP).
3. Send the reply
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":"Thanks for the message — here'\''s what I've got for you today"}'
A 200 means delivered and one credit spent. Failures (expired session, upstream error) aren't charged, so a retrying bot stays cost-safe.
4. Segment as you go
The bot shouldn't just reply — it should learn. When a fan tips, asks about a PPV, or goes quiet, add them to a fan segment so later campaigns target the right people:
# Tag this fan as a "big spender" (listId 9)
curl -X POST \
https://api.ofapis.com/api/public/v1/accounts/42/lists/9/users/78910 \
-H "Authorization: Bearer ofapis_sk_..."
Those lists are the same segments a mass DM targets, so the chatbot quietly builds the audiences your broadcasts use later.
Worked loop
message.receivedfires → verify HMAC → enqueue job.- Job reads the last 20 messages for context.
- Rules/LLM drafts a reply; a fan lookup personalises it.
POST .../messagessends it; the fan is added to the relevant list based on intent.
Keep humans in the loop
Many agencies run the bot as a draft-and-approve assistant: it proposes a reply, a chatter approves before it sends. The messaging API supports both fully-automated and assisted flows — the only difference is whether step 3 auto-triggers the send.
FAQ
Should the bot use webhooks or polling?
Webhooks. You can poll GET /accounts/{id}/chats, but that spends credits on every empty check and adds latency. message.received pushes only real events, so the bot reacts instantly and cheaply.
How does the bot get conversation context?
Call GET /accounts/{id}/chats/{chatId}/messages to read recent history and feed the last turns to your logic. Answering from a single incoming line usually produces worse replies than including a short window of context.
How does the chatbot help with segmentation?
As it reads intent, the bot adds fans to lists via POST /accounts/{id}/lists/{listId}/users/{targetUserId}. Those lists are the same segments your mass DMs target, so replies and campaigns share one source of truth.
Which language should I build it in?
Any — it's plain REST. There are quickstarts for Node, Python, Go and PHP.