Snippet Keyboard

Canned replies in one tap

View the Project on GitHub ptrinh/SnippetKeyboard-Public

Snippet file format

Export and import use a small, flat YAML dialect. It is plain text, so you can edit it in any editor and move it between iOS and Android.

# snippet-keyboard-format: 2
## Greetings
- "πŸ‘‹ | filter:πŸ‘‹"
- "πŸ‘‹πŸ€ | Hi, thanks for your message. I'm Alex, what's your name?"
- "πŸ‘‹πŸ™Œ | Hi, thanks for your message. I'm Alex."

## Work
- "πŸ“… | dynamic:https://example.com/today"
- "πŸ”— | https://example.com/book"
- "plain text with no label"

Rules

Line Meaning
## Name starts a category
- "label | text" a snippet; the label is what the bubble shows
- "text" a snippet with no label; the bubble shows the text
# comment, blank line ignored

Snippet kinds (iOS 1.3 / Android 1.2 and later)

The first line of the file is # snippet-keyboard-format: 2. The app writes it for you; it tells the app to read the kinds below. A file without it is treated as a 1.0 file (a bare https:// text is dynamic) and converted the next time it is saved.

Text starts with Kind Tapping the bubble
dynamic:https://… Dynamic fetches the URL and inserts the response
filter:πŸ‘‹ Filter shows only the snippets whose label contains πŸ‘‹; pick one and the list comes back
anything else Text inserts the text β€” a bare https://… link is inserted as a link

text: in front of a text that itself starts with one of those words keeps it literal. The app adds it when needed.

Extracting one value from a dynamic snippet

A dynamic snippet may have a second line with a rule that picks one part of the response. In the app, edit the snippet and use Pick what to insert…; the rule is written for you. In YAML:

- "πŸ’± | dynamic:https://tygiausd.org\nafter \"USD chợ Δ‘en\" between \"<td class=\\\"text-right\\\">\" \" \" #2"
- "πŸ’² | dynamic:https://api.example.com/rates\njson $.data.usd"

Rules: json PATH, after TEXT between START END #N, regex PATTERN. If the rule finds nothing, the URL is inserted instead.

Spaces and blank lines

Quotes are what preserve spaces at the start or end of the text. Inside quotes, the text is taken exactly as written:

- "Sign-off | Thanks   "        # keeps three trailing spaces
- "Gap | \n\n"                  # inserts two blank lines
- "Both |   Hello\n\nThanks\n\n"

Without quotes, leading and trailing spaces are trimmed.

This is useful when you build a reply from several snippets in a row: end each piece with the spacing the next one needs.

Kinds, extraction and edge whitespace require iOS 1.3 / Android 1.2 or later.