Skip to main content

How Bots Respond

Ever wondered what happens when someone messages your bot? Here's the behind-the-scenes journey of how BotGami processes a message and sends a response.


The Journey of a Message

When a user sends something to your bot:

All of this happens in milliseconds — users get instant responses!


Step by Step

1. User Sends Message

The user types something in Telegram and hits send.

2. Telegram Delivers It

Telegram forwards the message to BotGami.

3. Finding the Right Flow

BotGami looks at all your triggers to find a match:

  • Does any trigger match this message?
  • If yes, run that flow
  • If no, no response (unless you have a catch-all)

4. Running the Flow

The flow executes step by step:

  • Each node runs in order
  • Data passes along the wires
  • Decisions are made at condition nodes

5. Sending the Response

When the flow hits an action node (like Send Message), BotGami sends it to Telegram, which shows it to the user.


What Can Trigger a Flow?

Trigger TypeExample
Commands/start, /help, /menu
Any textUser sends "hello"
ButtonsUser clicks an inline button
PhotosUser sends a picture
LocationUser shares their location

You can have different flows for each type!


When Multiple Triggers Match

If a message could match multiple triggers, BotGami runs the first match.

Order Matters

Arrange your triggers from most specific to least specific:

  1. /start (exact command)
  2. Messages containing "help"
  3. Any text message (catch-all)

Waiting for Replies

Some flows need to pause and wait for the user to respond:

How Waiting Works

  1. The "Ask Question" node sends a message and pauses
  2. BotGami remembers where the flow stopped
  3. When the user replies, the flow resumes from that point
  4. The answer is automatically captured and available

This is how you build multi-step conversations!


Priority System

BotGami runs certain flows before others:

PriorityWhat RunsWhen
FirstGuard flowsEvery message — for access control
SecondYour triggersWhen they match
Guards

Guards are special flows that check things like "is this user allowed to use the bot?" before regular flows run.


Error Handling

What happens when something goes wrong?

  1. Minor issues — The flow tries to continue
  2. Major issues — The flow stops and logs an error
  3. Error handler — If you've set one up, it catches errors

You can add an "On Error" trigger to handle problems gracefully and send the user a helpful message instead of silence.


Response Times

How fast does BotGami respond?

Flow TypeTypical Time
Simple greeting< 100ms
Database lookup100-300ms
External API call200-1000ms

Users experience responses as "instant" for most flows.


Testing Your Flows

The best way to understand how your bot responds is to test it:

  1. Save your flow
  2. Open Telegram
  3. Message your bot
  4. See what happens!

There's no substitute for real testing with a real Telegram conversation.


Next Steps