Conversation Overview
Conversations allows you to maintain state and interact with a user over multiple steps without managing complex state machines manually. Gogram provides a robust API to ask questions, wait for input, and handle timeouts.Starting a Conversation
To start a conversation, you need aNewMessage context (usually from a command or message).
Input Methods
Simple Text Input
Ask a question and wait for a text response.Validator & Retries
Keep asking until the user provides valid input.Media Input
Wait for specific media types.Yes/No Questions
Easily handle boolean choices.Interactive Keyboards
Button Choices
Send options and wait for a button click.Conversation Wizard 🧙♂️
For complex multi-step forms, use the Wizard API.Advanced Control
Regex Matching
Wait for a message matching a pattern.Keyword Matching
Wait for message containing specific words.Custom Context
Pass a custom context for cancellation.Error Handling
| Error | Description |
|---|---|
ErrConversationTimeout | User didn’t respond in time. |
ErrConversationClosed | Conversation was closed manually. |
ErrConversationAborted | User sent an abort keyword (e.g., “cancel”). |
ErrValidationFailed | User failed validation after max retries. |