# Automate OnlyFans Chat with Webhooks and Real-Time Messaging API

> Get webhooks the instant a fan messages. Auto-respond, send PPV, trigger welcome sequences, and manage chat at scale — all via API. Build the chatting automation your agency needs.

*OnlyFans Chatting Automation is an independent, unofficial tool by Fans Holdings OÜ and is not affiliated with or approved by OnlyFans. It works only on accounts you own or are authorised in writing to manage, and only on your instructions. Automations are optional and stay off until you switch them on. You remain responsible for complying with the OnlyFans Terms of Service (including §8(b) and §8(g)) and applicable law. We never use OnlyFans content, messages or fan data to train or improve any AI model. AI-generated or AI-altered posts, media and voice messages must clearly feature the verified creator and be labelled #ai, as the OnlyFans Terms require. Review AI drafts before they are sent. Independent tool, your account, your call.*

[Start For Free](https://app.fansapi.com/register) · [Read the Docs](https://docs.fansapi.com/api-reference/chats/list-chats)

## How Chat Automation Works

Webhooks deliver fan messages to your server in real time. Your AI or rule engine processes them, then responds via the API — in seconds. We recommend human review of AI replies before they are sent.

### Fan Messages

Incoming message triggers webhook instantly

### Your Server

AI chatbot or rule engine processes message

### Typing Indicator

Show typing for natural conversation feel

### Auto-Reply

Send response via API — text, media, or PPV

## Real Webhook-Driven Chat Automation Use Cases

Each use case shows the webhook trigger and the API call to make. Build AI chatbots, welcome sequences, and upsell flows.

### Auto-Respond to New Messages

When a fan sends a message, your webhook fires instantly. Route the message to your AI chatbot or rule engine and respond within seconds.
- API: `POST /api/{account}/chats/{chat_id}/messages` — Send a reply message — text, media, or PPV
- Webhook: `messages.received` — Fires on every incoming fan message with full content and media

### Welcome New Subscribers Automatically

Trigger a welcome message sequence when a fan subscribes. Send a greeting, then follow up with PPV content on a schedule.
- API: `POST /api/{account}/chats/{chat_id}/messages` — Send the welcome message with optional media
- Webhook: `subscriptions.new` — Fires when a fan initiates a new subscription

### PPV Upsell on Tip Events

When a fan sends a tip, automatically follow up with exclusive PPV content — they already showed buying intent.
- API: `POST /api/{account}/chats/{chat_id}/messages` — Send a PPV message with price and media attachment
- Webhook: `tips.received` — Fires when a fan sends a tip with gross/net amounts

### Show Typing Indicators

Make automated responses feel human. Trigger typing indicators before sending replies for a natural conversation flow.
- API: `POST /api/{account}/chats/{chat_id}/typing` — Show typing indicator in the chat
- Webhook: `users.typing` — Fires when a fan starts typing — know when to engage

### Search and Analyze Chat History

Search through chat messages to find keywords, analyze conversation patterns, and extract insights for your AI models.
- API: `GET /api/{account}/chats/{chat_id}/messages/search` — Search messages within a specific chat
- Webhook: `messages.received` — Build a real-time message index as messages arrive

### Track Chat-Driven Revenue

Monitor which automated conversations drive the most PPV unlocks and tips. Optimize your chat flows for maximum revenue.
- API: `GET /api/{account}/engagement/messages/direct-messages` — Get direct message engagement and revenue stats
- Webhook: `messages.ppv.unlocked` — Fires when a fan unlocks PPV — attribute to chat flow

## Production-Ready Code Examples

Webhook handlers for auto-responding, welcome sequences, and tip-based upsells. Copy into your project and customize.

### Auto-Respond to Fan Messages

Listen for incoming messages via webhook, process with your AI chatbot, show typing indicator, then respond.

```ts
// Webhook handler: messages.received
app.post('/webhooks/onlyfans', async (req, res) => {
  const { event, account_id, payload } = req.body;

  if (event === 'messages.received') {
    // payload.fromUser = sender profile with subscription info
    // payload.text = message content (HTML)
    // payload.fanData.spending = fan's lifetime spend
    const { fromUser, text, fanData } = payload;

    // Skip if message is from the creator (outgoing)
    if (fromUser.isPerformer) return res.sendStatus(200);

    // Generate AI response (your chatbot logic)
    const aiReply = await yourAIChatbot.generateReply({
      message: text,
      fanName: fromUser.name,
      fanSpend: fanData.spending.total,
    });

    // Show typing indicator for natural feel
    await fetch(
      'https://app.fansapi.com/api/' + account_id + '/chats/' + fromUser.id + '/typing',
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer sk_your_api_key',
          'Content-Type': 'application/json'
        }
      }
    );

    // Wait 2-4 seconds to simulate typing
    await new Promise(r => setTimeout(r, 2000 + Math.random() * 2000));

    // Send the reply
    await fetch(
      'https://app.fansapi.com/api/' + account_id + '/chats/' + fromUser.id + '/messages',
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer sk_your_api_key',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({ text: aiReply })
      }
    );
  }

  res.sendStatus(200);
});
```

### Welcome Sequence for New Subscribers

When a fan subscribes, send a welcome message immediately, then follow up with PPV content after a delay.

```ts
// Webhook handler: subscriptions.new
app.post('/webhooks/onlyfans', async (req, res) => {
  const { event, account_id, payload } = req.body;

  if (event === 'subscriptions.new') {
    // payload.user = new subscriber profile
    const chatId = payload.user.id;

    // Step 1: Send immediate welcome message
    await fetch(
      'https://app.fansapi.com/api/' + account_id + '/chats/' + chatId + '/messages',
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer sk_your_api_key',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          text: 'Hey! Welcome 💕 So glad you are here. '
            + 'Check your DMs — I have something special for you.'
        })
      }
    );

    // Step 2: Upload exclusive welcome content
    const mediaResponse = await fetch(
      'https://app.fansapi.com/api/' + account_id + '/media/upload',
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer sk_your_api_key',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          file_url: 'https://your-cdn.com/welcome-exclusive.mp4'
        })
      }
    );
    const media = await mediaResponse.json();

    // Step 3: Send PPV after 30-minute delay
    setTimeout(async () => {
      await fetch(
        'https://app.fansapi.com/api/' + account_id + '/chats/' + chatId + '/messages',
        {
          method: 'POST',
          headers: {
            'Authorization': 'Bearer sk_your_api_key',
            'Content-Type': 'application/json'
          },
          body: JSON.stringify({
            text: 'Here is that special something I promised 🔥',
            price: 9.99,
            mediaFiles: [media.data.id]
          })
        }
      );
    }, 30 * 60 * 1000);
  }

  res.sendStatus(200);
});
```

### PPV Upsell After Tip

When a fan tips, they have buying intent. Automatically send a premium PPV follow-up to maximize revenue.

```ts
// Webhook handler: tips.received
app.post('/webhooks/onlyfans', async (req, res) => {
  const { event, account_id, payload } = req.body;

  if (event === 'tips.received') {
    // payload.user = tipper profile
    // payload.amountGross / payload.amountNet = tip amounts
    // payload.fanData.spending = lifetime spend breakdown
    const { user, amountGross, amountNet } = payload;
    const chatId = user.id;

    // Only upsell if tip is above threshold
    if (amountGross < 5) return res.sendStatus(200);

    // Select PPV content based on tip amount
    let ppvContent, ppvPrice;
    if (amountGross >= 50) {
      ppvContent = 'premium-exclusive.mp4';
      ppvPrice = 25.00;
    } else if (amountGross >= 20) {
      ppvContent = 'special-content.mp4';
      ppvPrice = 15.00;
    } else {
      ppvContent = 'bonus-content.mp4';
      ppvPrice = 9.99;
    }

    // Upload the PPV media
    const mediaResponse = await fetch(
      'https://app.fansapi.com/api/' + account_id + '/media/upload',
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer sk_your_api_key',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          file_url: 'https://your-cdn.com/' + ppvContent
        })
      }
    );
    const media = await mediaResponse.json();

    // Send personalized PPV upsell
    await fetch(
      'https://app.fansapi.com/api/' + account_id + '/chats/' + chatId + '/messages',
      {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer sk_your_api_key',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          text: 'Omg thank you so much for the tip!! 😍 '
            + 'You deserve something extra special...',
          price: ppvPrice,
          mediaFiles: [media.data.id]
        })
      }
    );
  }

  res.sendStatus(200);
});
```

## Available Endpoints and Webhooks

Every endpoint and webhook event for chat automation. Full documentation at docs.onlyfansapi.com.

| Method | Path | Description |
| --- | --- | --- |
| GET | `/api/{account}/chats` | List all chats with fans |
| GET | `/api/{account}/chats/{chat_id}/messages` | List messages in a chat |
| POST | `/api/{account}/chats/{chat_id}/messages` | Send a message — text, media, or PPV |
| GET | `/api/{account}/chats/{chat_id}/messages/search` | Search messages in a chat |
| POST | `/api/{account}/chats/{chat_id}/typing` | Show typing indicator |
| POST | `/api/{account}/chats/{chat_id}/mark-as-read` | Mark chat as read |
| POST | `/api/{account}/chats/mark-as-read` | Mark all chats as read |
| DELETE | `/api/{account}/chats/{chat_id}/messages/{id}` | Delete a message |
| POST | `/api/{account}/chats/{chat_id}/messages/{id}/like` | Like a message |
| POST | `/api/{account}/chats/{chat_id}/messages/{id}/pin` | Pin a message |
| GET | `/api/{account}/engagement/messages/direct-messages` | DM engagement stats |
| GET | `/api/{account}/engagement/messages/direct-messages/chart` | DM engagement chart data |

**Webhook events**

- `messages.received` — New incoming message from a fan — includes full content, media, and sender data
- `messages.sent` — Outgoing message sent to a fan — confirms delivery with message details
- `messages.ppv.unlocked` — Fan purchases a paid message — includes amount and fan spending history
- `messages.deleted` — A chat message was deleted — includes message ID
- `tips.received` — Fan sends a tip — trigger upsell flows with gross/net amounts
- `users.typing` — Fan is typing a message — know when to engage or prepare a response
- `subscriptions.new` — New subscriber — trigger welcome message sequences

## OnlyFans Chatting Automation — Frequently Asked Questions

Common questions about automating OnlyFans chat with webhooks and API.

### Can I build an AI chatbot for OnlyFans using this API?

Yes. The messages.received webhook fires instantly when a fan sends a message, delivering the full message content and sender data to your server. You route it to your AI model (ChatGPT, Claude, custom LLM), generate a reply, then send it back via the chat messages endpoint. Add a typing indicator before responding for a natural feel.

### How fast do message webhooks fire?

Webhooks fire within seconds of the event on OnlyFans. Combined with ~300ms API response times, your automated replies can reach fans in under 5 seconds — faster than most human chatters.

### Can I send PPV messages through the chat API?

Yes. The chat messages endpoint supports text, media attachments, and a price field. Upload your media first via the media/upload endpoint, then send the message with the media IDs and your desired PPV price. Works for both 1:1 chats and mass messaging.

### Can I automate welcome messages for new subscribers?

Yes. Listen for the subscriptions.new webhook, then use the chat messages endpoint to send a welcome message immediately. You can build multi-step sequences with delays — for example, a greeting on subscribe, then a PPV offer 30 minutes later.

### Does the API support typing indicators?

Yes. The typing endpoint lets you show a typing indicator in any chat. Use this before automated replies to make the conversation feel natural. The users.typing webhook also tells you when a fan starts typing, so you can prepare a response.

### Can I search through chat history?

Yes. The chat messages search endpoint lets you search messages within a specific chat. The list messages endpoint returns the full conversation history with pagination. Use these to build context for your AI chatbot or to analyze conversation patterns.

### How do I handle media in automated chats?

Upload media to the OnlyFans CDN using the media/upload endpoint — either a direct file or a URL. The endpoint returns a media ID that you attach to your message. Supports photos and videos. You can also access the chat media gallery to see all media exchanged in a conversation.

### Can I use this with Make.com, Zapier, or n8n?

Yes. OnlyFans API has native connectors for Make.com, Zapier, and n8n. You can build chat automation workflows without code — for example, trigger a Slack notification when a whale fan messages, or auto-respond with templates based on message keywords.

## Every Unanswered Message Is a Missed Sale.

Start free. Automate your first chat flow in minutes.

[Start Free](https://app.fansapi.com/register) · [View Pricing](https://fansapi.com/pricing)

## Links

- View on site: https://fansapi.com/onlyfans-chatting-automation
- Chats API docs: https://docs.fansapi.com/api-reference/chats/list-chats
- All 320+ endpoints: https://docs.fansapi.com/api-reference
- All 25 webhook events: https://docs.fansapi.com/webhooks/available-events
- Pricing: https://fansapi.com/pricing
- Sign up: https://app.fansapi.com/register