FansquareAPI reference
Open the app

Messaging fans

Scripts and sequences

Read, write and organise the scripts your chatters send, and build sequences from them, by hand or with an AI agent.

A script is a saved message, or a series of up to 5 messages, that a chatter sends to a fan in one pick from the conversation. Scripts are filed in collections, per creator: the library your team picks from.

A sequence turns scripts into the path of a conversation. It has ordered steps; each step offers one or more options, and each option sends a script when its condition holds. A sequence points to existing scripts, it never copies them: edit a script and every sequence that uses it follows.

Everything your team sees in Scripts in the app is available here, and as tools for an AI agent.

Scopes

ScopeGrants
read:scriptsList and read collections, scripts and sequences
write:scriptsCreate, edit and delete collections, scripts and sequences

Like every scope, they come with read:*, write:* and full access. A key limited to some creators only sees their scripts.

Scripts

GET /v1/scripts lists the scripts with their messages, filtered by creator_ids or collection_ids. Each message carries its text, its price in euro cents (price_cents, 0 for free), its media as MYM media uuids (media_ids) and is_voice for a voice message.

POST /v1/scripts creates a script in a collection, with 1 to 5 messages. The rules are those of the app editor:

  • a price is 0, or between 500 and 100 000 cents;

  • a paid message carries at least one media;

  • a voice message carries exactly one audio of the vault, and nothing else;

  • a media is a MYM media uuid of the creator's vault. Reuse the media_ids read on her scripts.

PATCH /v1/scripts/{script_id} changes only what it receives. messages replaces the whole series: send the id of each message you keep, so its send history stays; a message without id is new, a message left out is deleted. The first message is the script itself, its id is the script id.

A script of two messages
{
  "collection_id": "0197a3c2-0000-7000-8000-00000000c001",
  "name": "Premium content",
  "context_note": "After a compliment on the last post",
  "messages": [
    { "content": "I have something just for you" },
    { "content": "Shot this morning", "price_cents": 1500, "media_ids": ["0197a3c2-aaaa-7000-8000-000000000001"] }
  ]
}

context_note is for the chatters (when and why to send the script), it is never sent to the fan.

Sequences

GET /v1/script-sequences/{sequence_id} returns the whole tree. Each option has a condition, judged on what the fan did since the message of the previous step:

ConditionThe option is offered when
anyalways; the only condition allowed on the first step
no_replythe fan has not answered, after delay_hours if set
boughtthe fan bought the media of the previous step
not_boughtthe fan has not bought it, after delay_hours if set
othera case of your own, written in label

A sequence is written whole, in one call:

Two steps
{
  "creator_id": "Xb2kP9qLm4Rt7Vw1Zy3N",
  "name": "New subscriber",
  "steps": [
    {
      "title": "Welcome",
      "options": [{ "script_id": "0197a3c2-0000-7000-8000-00000000a001", "condition": "any" }]
    },
    {
      "title": "Premium content",
      "options": [
        { "script_id": "0197a3c2-0000-7000-8000-00000000a002", "condition": "no_reply", "delay_hours": 24 },
        { "script_id": "0197a3c2-0000-7000-8000-00000000a003", "condition": "bought" }
      ]
    }
  ]
}

A sequence created or replaced through the API is published: chatters are offered it in the conversation right away, next to the ones made in the app.

A refused tree returns 422 script_sequence_invalid, with every refused field in errors: its path (steps.1.options.0.script_id), a problem code and a message. Nothing is written until the whole tree is valid.

Turn your scripts into sequences with an AI agent

Your scripts already tell the story of your conversations: collections named "1. Welcome", "2. Premium", scripts kept in the order they are sent. An agent can read them and propose the sequences. Connect it with the MCP server, with read and write access, then ask:

Prompt
Look at the scripts of my creator Chloe. Propose sequences that follow the order my chatters use,
with an option for fans who do not answer and one for fans who bought. Show me each sequence before
creating it.

The agent lists the collections and scripts (list_script_collections, list_scripts), shows you the steps it proposes, then creates each sequence (create_script_sequence). Ask it to change a step and it sends the tree back with replace_script_sequence. Review the result in Scripts › Sequences in the app.