OpenParable
Skip to content
← Back to skills

Create Input Chain

Agent Building
create-input-chain

Create Input Chain is an Agent Skill for agent building published in the vendelieu/telegram-bot repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Creates multi-step input chains for conversation flows using the telegram-bot DSL. Use when building simple multi-step dialogs without wizard state persistence, or when inputChain is preferred over @WizardHandler.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/vendelieu/telegram-bot/blob/HEAD/.cursor/skills/create-input-chain/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/create-input-chain, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Create Input Chain

Quick Start

Define a chain inside bot.setFunctionality { }. Set bot.inputListener[user] = "id" to start. The chain advances automatically after each step.

bot.setFunctionality {
    onCommand("/start") {
        message { "What's your name?" }.send(user, bot)
        bot.inputListener[user] = "conversation"
    }
    inputChain("conversation") {
        message { "Nice to meet you, ${message.text}!" }.send(update.getUser(), bot)
        message { "What's your favorite food?" }.send(update.getUser(), bot)
    }.breakIf({ message.text == "peanut butter" }) {
        message { "Oh, too bad, I'm allergic." }.send(update.getUser(), bot)
    }.andThen {
        message { "Thanks! You said: ${message.text}" }.send(update.getUser(), bot)
    }
}
bot.handleUpdates()

Structure

  • inputChain("id") { } — First step. Block runs when user sends a message while inputListener is "id".
  • andThen { } — Next step. Chain advances to this step after the previous block runs.
  • breakIf(condition, repeat = true, block) — On current step: if condition is true, run block. If repeat = true, stay on current step (user can re-enter). If repeat = false, do not re-register.

Context

Inside each block, ProcessingContext / ActivityCtx provides:

  • update — the ProcessedUpdate
  • message — shortcut for message content (when applicable)
  • update.getUser() — user reference

When to Use

  • Input chain: Simple linear flows, no typed state, quick setup
  • Wizard: Complex validation, typed state, Transition.JumpTo/Retry, state managers

Reference