Skip to content

Creating and Connecting a Telegram Bot

To work with Grailgun, you need to create and connect a Telegram bot. The process consists of several steps:

  1. Creating a bot in Telegram through the official @BotFather bot
  2. Getting the API key (token) for your bot
  3. Connecting the bot to the Grailgun platform using the obtained key

@BotFather is the official Telegram bot that allows you to create and manage bots. Here’s a step-by-step guide to creating a new bot:

  1. Open the Telegram app
  2. Type “@BotFather” in the search
  3. Select the official @BotFather bot (marked with a blue checkmark ✓)

Step 2: Start a conversation with @BotFather

Section titled “Step 2: Start a conversation with @BotFather”
  1. Click the “Start” button or send the /start command
  2. BotFather will respond with a welcome message and a list of available commands
  1. Send the /newbot command
  2. BotFather will ask you to provide a name for your bot. This is the display name that users will see (e.g., “My Assistant”)
  3. After specifying the name, BotFather will ask for a username for the bot. This is a unique identifier that must end with “bot” (e.g., “my_assistant_bot”)

After successfully creating the bot, BotFather will send you a message with information about the bot and its token (API key). It looks something like this:

Done! Congratulations on your new bot. You will find it at t.me/my_assistant_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
Use this token to access the HTTP API:
1234567890:ABCDefGhIJKlmNoPQRsTUVwxyZ
Keep your token secure and store it safely, it can be used by anyone to control your bot.

⚠️ Important: The bot token is secret information. Never share it with strangers or publish it publicly!

You can configure additional parameters for your bot by sending the following commands to @BotFather:

  • /setdescription — set bot description
  • /setabouttext — set “About the bot” information
  • /setuserpic — set bot avatar
  • /setcommands — configure bot menu commands

After creating a bot in Telegram, you need to connect it to the Grailgun platform:

  1. Open the Grailgun platform in your browser
  2. Log in to your account or register if you don’t have an account yet
  1. On the main page, click the “Create Flow” button
  2. Use AI-builder to create first verison of your future bot. (this is a mandatory action to show you how builder looks and could be configured)
  1. Once the AI-builder process is done there will be a form to choose a channel and input your bot-token. (this is optional)
  2. Select Telegram channel
  3. Paste the token you received from @BotFather into the input field
  4. Press “Save channel settings”

Alternative way to connect or update your bot token is always available via flow Settings

Section titled “Alternative way to connect or update your bot token is always available via flow Settings”
  1. Go to the “Settings” section using the button in the sidebar and find “Bot Configuration” block
  2. Paste the token you received from @BotFather
  3. Click the “Update Bot” button
  4. If the token is correct, you’ll see a green string “Bot connected:” with the name of your bot next to button

To ensure your bot is properly connected and working:

  1. Open Telegram and find your bot by username
  2. Send it any message
  3. If everything is configured correctly, you’ll see this message in the Grailgun conversations interface

On the bot settings page in Grailgun, you can:

  • View bot information (name, username, avatar)
  • Copy data for use in other services
  • Delete the bot (with the option to delete the webhook in Telegram)

If you lost the bot token, you can retrieve it by sending the /token command to @BotFather and selecting the desired bot from the list.

Can I change the bot username after creation?

Section titled “Can I change the bot username after creation?”

Yes, you can change the bot username through @BotFather by sending the /setusername command and selecting the desired bot.

What should I do if an error occurs during connection?

Section titled “What should I do if an error occurs during connection?”

Make sure you copied the bot token correctly without extra spaces. If the problem persists, check the bot’s webhook status in its Settings section.

To delete a bot in Grailgun:

  1. Go to the bot settings page
  2. Click the “Delete Bot” button
  3. Confirm the action

This will remove the bot from Grailgun and, if you select the appropriate option, also delete the webhook in Telegram. The bot itself in Telegram will remain active. For complete bot deletion, use the /deletebot command in @BotFather.