The moment it happens
Look up and update Airtable records from a Telegram bot
You message your Telegram bot in plain words and it finds, adds or updates records in Airtable, then replies.
- Runs
- The moment it happens
- Apps
- Airtable, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- bot token; Airtable read+write
Send this to your assistant
Create a ClickRuntime automation: when I message my Telegram bot, work out whether I want to find, add or update an employee, do it in my Airtable 'Employees' table, and reply with the result. Only answer people on my allowed list.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An office manager at a 40-person company keeps the staff directory in Airtable: phone numbers, desk locations, start dates, managers. They are often away from their desk when someone asks for a colleague's extension or a new starter's details need adding. Opening the base on a phone and finding the right field is slow.
Being able to type 'what's Ana's extension?' or 'add Tom Reyes, starts Monday, sales' to a Telegram bot and get an answer back puts the directory in their pocket, while the records stay in Airtable.
What you get out of it
Plain messages, not commands
You write the way you would to a colleague. AI works out whether you want to find, add or update someone.
Answers in seconds
Look-ups come back in the same chat, so a quick question gets a quick reply.
Changes go straight into Airtable
Additions and updates are written to the Employees table, so the directory stays the single source.
Only approved people can use it
Messages from chats that are not on your allow-list get a short refusal and nothing in Airtable is touched.
How it works
What happens, step by step
You send a message to your Telegram bot, and Telegram forwards it to ClickRuntime.
It checks the sender is on your allowed list and ignores anyone else.
AI works out whether you want to find, add or update someone, and which details you gave.
The Employees table in Airtable is searched, added to or updated.
The bot replies in the chat with what it found or changed.
Before it runs live
- Connect Airtable
- Connect Telegram
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Airtable and Telegram steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_event, credentials, http, ai
BASE_ID = "appXXXXXXXXXXXXXX"
ALLOWED = {123456789, 987654321}
SCHEMA = {"type": "object", "properties": {"action": {"enum": ["find", "add", "update"]}, "name": {"type": "string"},
"fields": {"type": "object", "properties": {"Phone": {"type": "string"}, "Team": {"type": "string"},
"Start date": {"type": "string"}, "Desk": {"type": "string"}}}}, "required": ["action", "name"]}
@on_event
def handle(event):
msg = (event.json or {}).get("message") or {}
chat_id, text = msg.get("chat", {}).get("id"), msg.get("text", "")
tg = f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/sendMessage"
if chat_id not in ALLOWED or not text:
return {"ignored": True}
req = ai.generate(text, system="Decide find, add or update for an employee directory. Dates as YYYY-MM-DD.",
json_schema=SCHEMA, max_output_tokens=150).json
api, headers = f"https://api.airtable.com/v0/{BASE_ID}/Employees", {"Authorization": f"Bearer {credentials.connection('airtable', 'work')}"}
name = req["name"].replace("'", "")
found = http.get(api, headers=headers, params={"filterByFormula": f"SEARCH(LOWER('{name}'), LOWER({{Name}}))"}).json()["records"]
if req["action"] == "add":
http.post(api, headers=headers, json={"typecast": True, "records": [{"fields": {"Name": req["name"], **req.get("fields", {})}}]}).raise_for_status()
reply = f"Added {req['name']}."
elif len(found) != 1:
reply = "No match found." if not found else "Several matches: " + ", ".join(r["fields"].get("Name", "") for r in found[:5])
elif req["action"] == "update":
http.patch(api, headers=headers, json={"records": [{"id": found[0]["id"], "fields": req.get("fields", {})}]}).raise_for_status()
reply = f"Updated {found[0]['fields'].get('Name')}."
else:
reply = "\n".join(f"{k}: {v}" for k, v in found[0]["fields"].items())
http.post(tg, json={"chat_id": chat_id, "text": reply})
return {"action": req["action"]}FAQ
Common questions
How does it know which employee I mean?
Can it delete records?
Can I use it for something other than employees?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Turn Telegram meeting notes into minutes in Airtable
You send rough notes to your Telegram bot after a meeting and tidy minutes with decisions and action items are saved in Airtable.
See how it worksLog each sale to Airtable and get a Telegram ping
Every sale from your store is added to Airtable and you get a Telegram message with the product and amount.
See how it worksSet reminders by Telegram message and get them on time
You tell your Telegram bot what to remind you about and when, it saves the reminder in Airtable, and sends it to you when it is due.
See how it worksKeep exploring
Set up “Look up and update Airtable records from a Telegram bot” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.