Answer
2 fieldsOne question customers ask, with the reply the bot sends.
- question
- required, at most 300 characters
- reply
- required, at most 4000 characters
Only your key saves answers. The bot reads them when a message arrives.
Customers write to your Telegram bot. It sends the answer you saved, and a question it cannot answer waits for you.
For a shop or venue that answers the same questions every day.
Start the FAQ bot on Telegram blueprint on Typestate
Started FAQ bot on Telegram: 2 record types, 3 web endpoints.
4 actions are compiling.
Deployed to Sandbox. Try it at your Sandbox address.
Each step has 3 parts: who starts it, how it reaches your backend, and the action that answers.
The rule you will want to change first
When no saved answer fits, the bot says a person will answer soon, and the question waits for you.
It lives in the action Answer a Message. Tell your agent how you want it instead: one sentence changes, and you read the change before it goes Live.
The map shows the records it keeps, the actions it runs and the services it calls.
What it keeps
What it does
What it reaches
One question customers ask, with the reply the bot sends.
Only your key saves answers. The bot reads them when a message arrives.
Each message a customer sent, and whether the bot answered it.
The bot keeps each message. Only your key reads them and replies.
Open an action to read its steps: each sentence, with the calls that do it under it.
From the webPOST /answers
Questiontext, needed
Replytext, needed
Create an Answer with question and reply set to the given question and reply.
Add an Answer
set question to input.question
set reply to input.reply
Answer with that Answer's id.
Answer
id is answer.id
Messagea record, needed
A message arrived on Telegram.It reads the chat, the sender's first name and the text of the message.
incoming is input.message
When the message has no text, such as a photo, stop.
When incoming.text holds no value
Answer
Find up to 100 Answers, oldest first.
answers is
Find all Answers
sorted by created_at, lowest first
Write each Answer as one line of its place in that list, from 1, and its question.
Write each Answer as one line of its place in that list, from 1, and its question.
Your agent wrote this ruleAsk Anthropic which line answers the text of the message, and take the number it names.If that call fails, or it names no number, the number is 0.
A model reads the customer's own words, so "when do you open" finds the answer to "What are your opening hours?".
choice is
Ask Anthropic to Create Message
max tokens is 10
messages is a list of 1:
content is the text
Questions: faq Message: incoming.text
role is "user"
model is "claude-haiku-4-5"
system is the text
Each line below is a number and a question. Reply with only the number of the line that answers the customer's message, or with 0 when none does.
when it fails, go on
picked is
when
choice holds a value
then
take choice.content
then take the text of its first item
then cut the spaces at its ends
then read it as a number
or, when that gives nothing, take 0
then round it to a whole number
otherwise 0
When the number is 1 or more, find the Answer at that place among the Answers, oldest first.
found is
Find all Answers
sorted by created_at, lowest first
When an Answer matches, send its reply to the chat on Telegram, and keep the message as a Question with state answered and answer_id set to that Answer's id.Otherwise, send "Thank you. A person will answer you here soon." to the chat on Telegram, and keep the message as a Question with state open.Each Question keeps the chat, the sender's first name and the text.
chat is "incoming.chat.id as a number"
When number of found is more than 0
Ask Telegram to Send Message
chat id is chat
text is the reply of the first item of the value named found
Add a Question
set answer_id to the id of the first item of the value named found
set chat_id to chat
set name to incoming.from.first_name
set state to "answered"
set text to incoming.text
Otherwise
Ask Telegram to Send Message
chat id is chat
text is "Thank you. A person will answer you here soon."
Add a Question
set chat_id to chat
set name to incoming.from.first_name
set state to "open"
set text to incoming.text
From the webGET /questions
Nothing. It needs no input.
Find up to 100 Questions whose state is open, oldest first.
open_questions is
Find Questions where
state is "open"
sorted by created_at, lowest first
Answer with each Question's id, name, text and the time it was asked.
Answer
questions is
each question of open_questions as
asked_at is question.created_at
id is question.id
name is question.name
text is question.text
From the webPOST /questions/reply
Question IDtext, needed
Replytext, needed
Find the Question whose id is the given question id.When none matches, refuse with "No such question".
question is
Find the first Question where
id is input.question_id
when none refuse "No such question"
Send the given reply to that Question's chat on Telegram.
Ask Telegram to Send Message
chat id is question.chat_id
text is input.reply
Change that Question's state to answered.
Change the Question where
id is question.id
set state to "answered"
Answer with that Question's id.
Answer
id is question.id
| What it does | Who may call | Address |
|---|---|---|
| Only you, with your key, save answers. | you, with your key | POST /answers |
| Only you, with your key, read the open questions. | you, with your key | GET /questions |
| Only you, with your key, reply to a question. | you, with your key | POST /questions/reply |
Typestate is the backend. Paste this brief into Lovable, v0, Claude Code or the tool that builds your pages.
Starting from this blueprint does not count against the action changes of your plan. The Free plan runs it on Sandbox. Live needs a paid plan.
Start the FAQ bot on Telegram blueprint on TypestateChoose a planEach sale and delivery moves the stock, and the owner gets one email when a product runs low.
Readers subscribe for free or pay monthly. Paid issues go to paying readers first, and open to everyone after 30 days.
People join a waiting list from your page, and each friend they bring moves them up.