Before you start
Ask the user to authorize your app withmessages:write, which lets your app send messages. Use the returned access token and select a linked account the user shared. You also need the fan’s numeric OnlyFans user ID.
Install the TypeScript SDK version 4. Create a client on your server:
Select a recipient
Use the fan’s numeric OnlyFans ID in the URL. If you do not have it, read fans or chats with the read permission listed in that guide. For the example below, that ID is123456.
Send text
data field around it. Save message.id with the recipient. You have finished when that record contains the message ID.
If you do not know whether the request succeeded, check the conversation with messages:read. Follow error recovery before trying again. A timeout can happen after the message was sent.
To reply to one message, add its ID as the string replyToMessageId. To send text or HTML unchanged, set isMarkdown: false. See Text formatting.
Read the recent conversation (optional)
If you need context before sending, requestmessages:read when the user authorizes your app. Then read recent messages. Skip this request when you already know the recipient and message.
history.items. Follow history.page.nextCursor for older messages while history.page.hasMore is true.
Attach media and set a price
Upload new media or choose existing Vault IDs. Pass this object asbody to client.access.chats.messages.send({ userId: 123456, body }):
price from 0 to 200. Set previewMediaCount to a whole number from zero to the number of attachments. When charging, keep some text or media paid.
To include release forms for people in the media, add releaseForms: { "users": [123456], "partners": [], "guests": [] }. Use numeric IDs in these arrays. See Media references for supported attachment formats and single-use upload references.