# net.anisota.feed.template

> A reusable post or reply: a stock answer, a fill-in-the-blanks message, or a pointer to an existing post to quote. The composer turns a template into an ordinary app.bsky.feed.post; nothing about the template travels with the published post. Text may contain {{key}} placeholders. Keys beginning with 'their.' or 'my.', and the key 'today', are filled by the client from context (the post being replied to, the signed-in account, the date); every other key is asked for when the template is used. Facets are deliberately absent: their byte offsets would shift once placeholders are filled, so the composer detects mentions, links and tags after filling, as it does for anything typed. How often a template is used is kept on the device, so using one never rewrites this record.

- Kind: record
- Record key: tid
- Authority: feed.anisota.net
- Lexicon: 1
- Published by [anisota.net](https://lexicon.garden/identity/did:plc:lcieujcfkv4jx7gehsvok3pr), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:lcieujcfkv4jx7gehsvok3pr/net.anisota.feed.template)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:lcieujcfkv4jx7gehsvok3pr/net.anisota.feed.template/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:lcieujcfkv4jx7gehsvok3pr/net.anisota.feed.template/analytics)

## Record (`net.anisota.feed.template`)

Type: record · key tid

### Properties

- `createdAt` (string · datetime, required): Client-declared timestamp when this template was created.
- `embed` (union): Attached to every post made from the template. A record embed is how a template points at an existing post to quote.
  - One of: `app.bsky.embed.record`, `app.bsky.embed.external`, `app.bsky.embed.images`, `app.bsky.embed.recordWithMedia`
- `group` (string): Optional heading the picker files the template under, e.g. 'Questions' or 'Bug reports'.
  - Constraints: maxLength: 640, maxGraphemes: 64
- `keywords` (array): Words that, when they appear in the post being replied to, make the composer suggest this template first. Matched on the client, case-insensitively.
  - Constraints: maxLength: 20
  - `items` (string)
    - Constraints: maxLength: 64
- `langs` (array): Languages of the template text, when the writer set them. Clients may use them as a hint; they are not applied to posts automatically.
  - Constraints: maxLength: 3
  - `items` (string · language)
- `name` (string, required): What the template is called in the picker, e.g. 'Is there an app?'.
  - Constraints: maxLength: 640, maxGraphemes: 64
- `shortcut` (string): Optional short word. Typing a slash followed by it in the composer offers this template.
  - Constraints: maxLength: 32
- `text` (string, required): The post text, with optional {{key}} placeholders. May be empty when the template only carries an embed (a quote of an existing post, say). The filled result is held to the post limit by the composer, not here.
  - Constraints: maxLength: 3000, maxGraphemes: 300
- `updatedAt` (string · datetime): Client-declared timestamp when this template was last edited.
- `use` (string): Where the composer offers the template: as a reply, on a new post, or both.
  - Constraints: default: "any", knownValues: any | reply | post
- `variables` (array): How to ask for each placeholder. A placeholder with no entry here is still asked for, with its key as the label. Context keys ('their.*', 'my.*', 'today') need no entry; one only supplies a label for when the context is missing, as when a reply template is used on a new post.
  - Constraints: maxLength: 12
  - `items` (ref)
    - Reference: `#variable`

## #variable (`net.anisota.feed.template#variable`)

Type: object

How the composer asks for one {{key}} placeholder.

### Properties

- `choices` (array): The options for a 'choice' placeholder. Each is inserted as written.
  - Constraints: maxLength: 12
  - `items` (string)
    - Constraints: maxLength: 3000, maxGraphemes: 300
- `default` (string): Pre-filled answer, which can be changed when the template is used.
  - Constraints: maxLength: 3000, maxGraphemes: 300
- `hint` (string): An example or note shown under the answer field.
  - Constraints: maxLength: 2000, maxGraphemes: 200
- `key` (string, required): The placeholder this describes, without braces: 'idea' for {{idea}}.
  - Constraints: maxLength: 32
- `kind` (string): 'text' asks for a free answer; 'choice' offers the strings in 'choices'.
  - Constraints: default: "text", knownValues: text | choice
- `label` (string): The question asked when the template is used, e.g. 'What did they suggest?'.
  - Constraints: maxLength: 640, maxGraphemes: 64
- `optional` (boolean): When true the placeholder may be left blank, and it is removed from the text.
  - Constraints: default: false

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A reusable post or reply: a stock answer, a fill-in-the-blanks message, or a pointer to an existing post to quote. The composer turns a template into an ordinary app.bsky.feed.post; nothing about the template travels with the published post. Text may contain {{key}} placeholders. Keys beginning with 'their.' or 'my.', and the key 'today', are filled by the client from context (the post being replied to, the signed-in account, the date); every other key is asked for when the template is used. Facets are deliberately absent: their byte offsets would shift once placeholders are filled, so the composer detects mentions, links and tags after filling, as it does for anything typed. How often a template is used is kept on the device, so using one never rewrites this record.",
      "key": "tid",
      "record": {
        "properties": {
          "createdAt": {
            "description": "Client-declared timestamp when this template was created.",
            "format": "datetime",
            "type": "string"
          },
          "embed": {
            "description": "Attached to every post made from the template. A record embed is how a template points at an existing post to quote.",
            "refs": [
              "app.bsky.embed.record",
              "app.bsky.embed.external",
              "app.bsky.embed.images",
              "app.bsky.embed.recordWithMedia"
            ],
            "type": "union"
          },
          "group": {
            "description": "Optional heading the picker files the template under, e.g. 'Questions' or 'Bug reports'.",
            "maxGraphemes": 64,
            "maxLength": 640,
            "type": "string"
          },
          "keywords": {
            "description": "Words that, when they appear in the post being replied to, make the composer suggest this template first. Matched on the client, case-insensitively.",
            "items": {
              "maxLength": 64,
              "type": "string"
            },
            "maxLength": 20,
            "type": "array"
          },
          "langs": {
            "description": "Languages of the template text, when the writer set them. Clients may use them as a hint; they are not applied to posts automatically.",
            "items": {
              "format": "language",
              "type": "string"
            },
            "maxLength": 3,
            "type": "array"
          },
          "name": {
            "description": "What the template is called in the picker, e.g. 'Is there an app?'.",
            "maxGraphemes": 64,
            "maxLength": 640,
            "type": "string"
          },
          "shortcut": {
            "description": "Optional short word. Typing a slash followed by it in the composer offers this template.",
            "maxLength": 32,
            "type": "string"
          },
          "text": {
            "description": "The post text, with optional {{key}} placeholders. May be empty when the template only carries an embed (a quote of an existing post, say). The filled result is held to the post limit by the composer, not here.",
            "maxGraphemes": 300,
            "maxLength": 3000,
            "type": "string"
          },
          "updatedAt": {
            "description": "Client-declared timestamp when this template was last edited.",
            "format": "datetime",
            "type": "string"
          },
          "use": {
            "default": "any",
            "description": "Where the composer offers the template: as a reply, on a new post, or both.",
            "knownValues": [
              "any",
              "reply",
              "post"
            ],
            "type": "string"
          },
          "variables": {
            "description": "How to ask for each placeholder. A placeholder with no entry here is still asked for, with its key as the label. Context keys ('their.*', 'my.*', 'today') need no entry; one only supplies a label for when the context is missing, as when a reply template is used on a new post.",
            "items": {
              "ref": "#variable",
              "type": "ref"
            },
            "maxLength": 12,
            "type": "array"
          }
        },
        "required": [
          "name",
          "text",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "variable": {
      "description": "How the composer asks for one {{key}} placeholder.",
      "properties": {
        "choices": {
          "description": "The options for a 'choice' placeholder. Each is inserted as written.",
          "items": {
            "maxGraphemes": 300,
            "maxLength": 3000,
            "type": "string"
          },
          "maxLength": 12,
          "type": "array"
        },
        "default": {
          "description": "Pre-filled answer, which can be changed when the template is used.",
          "maxGraphemes": 300,
          "maxLength": 3000,
          "type": "string"
        },
        "hint": {
          "description": "An example or note shown under the answer field.",
          "maxGraphemes": 200,
          "maxLength": 2000,
          "type": "string"
        },
        "key": {
          "description": "The placeholder this describes, without braces: 'idea' for {{idea}}.",
          "maxLength": 32,
          "type": "string"
        },
        "kind": {
          "default": "text",
          "description": "'text' asks for a free answer; 'choice' offers the strings in 'choices'.",
          "knownValues": [
            "text",
            "choice"
          ],
          "type": "string"
        },
        "label": {
          "description": "The question asked when the template is used, e.g. 'What did they suggest?'.",
          "maxGraphemes": 64,
          "maxLength": 640,
          "type": "string"
        },
        "optional": {
          "default": false,
          "description": "When true the placeholder may be left blank, and it is removed from the text.",
          "type": "boolean"
        }
      },
      "required": [
        "key"
      ],
      "type": "object"
    }
  },
  "id": "net.anisota.feed.template",
  "lexicon": 1
}
```
