messageUuid for each reply. It starts with a template reply so it runs end to end; you swap in your own reply logic afterwards. Run it once or on a schedule.
You need:
- a Bearer access token for the creator’s account; Build your first app gets you one. Access tokens are short-lived, so refresh yours if it has expired.
- the
read:self,read:chatandwrite:chatscopes on that token - Python 3.9 or later (the example uses the
requestslibrary) or Node.js 18 or later (which hasfetchbuilt in). Pick one tab in each step.
Keep the token in an environment variable rather than in source; the examples read it from
FANVUE_TOKEN.
How it works
Four requests do the work. Every request goes tohttps://api.fanvue.com with Authorization: Bearer <token> and X-Fanvue-API-Version: 2025-06-26.
GET /chats/unread looks like the obvious call but returns only counts (unread chats and unread messages), not the chats. To get the list with each fan’s user.uuid, use GET /chats with filter=unread.
Step 1: Set up the API client
Every call shares the base URL, the Bearer token and the version header, so wrap them once in a client with one helper per endpoint.- Python
- TypeScript (Node.js)
Install the one dependency, then create
fanvue.py:fanvue.py
Step 2: Find the unread chats
GET /chats?filter=unread returns a paginated list (size default 15, maximum 50). Each item describes one conversation, with the fan as user (including the user.uuid you reply to), isRead, unreadMessagesCount and a lastMessage preview.
A trimmed response:
isRead, not only on unreadMessagesCount. A chat the creator marked unread by hand has isRead: false and unreadMessagesCount: 0, so decide whether your script should answer those. The user.uuid value is the userUuid path parameter for the next two endpoints.
Step 3: Read the conversation and draft a reply
For each unread chat, callGET /chats/{userUuid}/messages. Messages come back newest first, and every message carries sender.uuid. Compare it with your own uuid from GET /users/me to confirm the latest message is from the fan and not a reply you already sent.
A trimmed messages response:
BROADCAST mass messages the creator sent to this fan, interleaved by publish date, so skip them when you look for the fan’s latest message. POST /chats/messages/batch returns direct messages only.
The draft function starts with a template so the script runs end to end. Replace its body with your own reply logic, passing the recent messages as context and returning a short reply.
- Python
- TypeScript (Node.js)
draft.py
Step 4: Send the reply
POST /chats/{userUuid}/message posts your text. The body needs text (1 to 5000 characters). On success the API returns 201 with the new message’s UUID:
400 and a contactability error when the fan can’t be messaged, for example because they aren’t subscribed. Catch that case per chat so one fan doesn’t stop the whole run.
The body also accepts mediaUuids, price (USD cents, minimum 300) to make the message pay-to-view, mediaPreviewUuid, templateUuid and gif. This guide sends plain text. See Read and send messages for the full body.
Step 5: Put it together
Wire the four calls into one loop: identify yourself, fetch unread chats, then read, draft and send for each. SetFANVUE_TOKEN in your environment first.
- Python
- TypeScript (Node.js)
reply.py
Expected result
With three unread chats, a run prints:sent line is a message now visible in the creator’s chat with that fan. Run the script again and the chats you answered no longer appear in the unread list, because your reply marked the conversation as read.
Next steps
To run the script continuously, schedulereply.py or reply.ts with cron or a background worker, and add a review step if a human should approve drafts before they send. Each run spends two requests per unread chat plus two, so check the budget in Rate limits. The events you can receive about chats instead of checking for them are in Creator message events.