See llms.txt for all machine-readable content.

Back to Templates

Route Telegram support messages with TypeSafe Jev, OpenAI and Google Sheets

Quick overview

This workflow handles incoming Telegram customer messages, classifies intent and sentiment with TypeSafe Jev, answers FAQs and simple cases with canned replies, uses OpenAI for product questions, notifies an owner in Telegram when needed, and logs every conversation to Google Sheets.

How it works

  1. Triggers when a new Telegram message is received by your bot and normalizes the update into a consistent chat, user, and text payload.
  2. If the message has no text content, it replies in Telegram asking the customer to send their question as text.
  3. Sends the customer message and your shop context to TypeSafe Jev to classify intent, match an FAQ topic, and score negativity and urgency.
  4. Chooses a route based on confidence thresholds: ignore spam, send a canned reply for FAQs/chitchat/orders/hand-off cases, or escalate unclear/product questions to OpenAI.
  5. For AI-routed messages, prompts OpenAI (ChatGPT) to answer using only the provided product catalog and FAQ text, then falls back to a safe handoff message if the AI cannot answer.
  6. Replies to the customer in Telegram, optionally notifies the owner in Telegram for handoffs, order questions, urgent messages, or AI-uncertain cases, and appends a message log row to Google Sheets.

Setup

  1. Create a Telegram bot with @BotFather and add Telegram credentials to the trigger, customer reply, and owner notification nodes.
  2. Add a TypeSafe Jev HTTP Bearer credential for the TypeSafe API request.
  3. Add an OpenAI credential for the OpenAI chat model used to answer product questions.
  4. Add a Google Sheets OAuth credential and set the target spreadsheet URL and sheet tab name.
  5. Update the configuration values (shop info, product catalog, FAQ JSON, confidence thresholds, and ownerChatId) to match your business, then activate the workflow.