The moment it happens
Save business cards to Google Contacts from Telegram
Send a photo of a business card to your Telegram bot and it is saved as a Google Contact, with a reply confirming the details.
- Runs
- The moment it happens
- Apps
- Google Contacts, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- contacts write; bot token
Send this to your assistant
Create a ClickRuntime automation: when I send a photo to my Telegram bot, read the business card, create a Google Contact with the name, company, email and phone, and reply with what was saved.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
After a trade show or a day of meetings, business cards pile up in a pocket. Typing them in is tedious, so it gets put off, and by the time it happens half the context is gone and some cards are lost.
Sales people, founders and consultants who meet people in person use it to save a contact in the moment, from the phone already in their hand, without a separate scanning app.
What you get out of it
Saved before you leave the room
A photo takes a few seconds, so the contact exists before the conversation is forgotten. Following up the same day becomes easy.
Lands where you already look
The contact goes straight into Google Contacts, so it appears in Gmail, on your phone and in any tool that reads your contacts.
No extra app to install
You use a Telegram chat you already have. There is no scanner subscription and no export step.
You see what was saved
The bot replies with the name, company, email and phone it stored, so a misread digit is caught right away.
How it works
What happens, step by step
When you send a photo to your Telegram bot, ClickRuntime receives it straight away and ignores messages from anyone but you.
The text on the card is read from the image.
AI picks out the name, company, job title, email and phone.
A new contact is created in your Google Contacts, with any caption you added saved as a note.
The bot replies with the details it saved.
Before it runs live
- Connect Google Contacts
- 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 Google Contacts and Telegram steps into one automation
Under the hood
The code that runs this automation
import base64
from clickruntime import on_event, credentials, http, ai
MY_CHAT = 123456789
FIELDS = {"type": "object", "properties": {k: {"type": "string"} for k in ["name", "company", "title", "email", "phone"]}}
@on_event
def handle(event):
msg = (event.json or {}).get("message") or {}
if msg.get("chat", {}).get("id") != MY_CHAT or not msg.get("photo"):
return {"skipped": True}
tg = f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}"
path = http.get(f"{tg}/getFile", params={"file_id": msg["photo"][-1]["file_id"]}).json()["result"]["file_path"]
image = base64.b64encode(http.get(f"https://api.telegram.org/file/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{path}").content).decode()
auth = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
ocr = http.post("https://vision.googleapis.com/v1/images:annotate", headers=auth, json={"requests": [
{"image": {"content": image}, "features": [{"type": "TEXT_DETECTION"}]}]}).json()
text = ocr["responses"][0].get("fullTextAnnotation", {}).get("text", "")
c = ai.generate(f"Extract the contact details from this business card:\n{text[:2000]}", json_schema=FIELDS,
max_output_tokens=200).json
person = {"names": [{"unstructuredName": c.get("name", "")}],
"organizations": [{"name": c.get("company", ""), "title": c.get("title", "")}],
"emailAddresses": [{"value": c["email"]}] if c.get("email") else [],
"phoneNumbers": [{"value": c["phone"]}] if c.get("phone") else [],
"biographies": [{"value": msg["caption"]}] if msg.get("caption") else []}
http.post("https://people.googleapis.com/v1/people:createContact", headers=auth, json=person).raise_for_status()
summary = "\n".join(f"{k}: {v}" for k, v in c.items() if v)
http.post(f"{tg}/sendMessage", json={"chat_id": MY_CHAT, "text": "Saved to Google Contacts\n" + summary})
return {"saved": c.get("name")}FAQ
Common questions
How is the text on the card read?
What if a field is read wrongly?
Can I add a note about where we met?
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
Get birthday reminders from your contacts on Telegram
Each morning a Telegram message lists today's birthdays from your Google Contacts, with a short greeting you can send.
See how it worksGet error alerts with a plain-English explanation
When one of your jobs or systems fails, #ops gets the error and a one-line guess at the cause, without the same error twice in an hour.
See how it worksSend your best leads to sales straight away
Every contact form message is scored, and the promising ones reach #sales while they're still warm.
See how it worksKeep exploring
Set up “Save business cards to Google Contacts from Telegram” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.
