Skip to content

Get started

Create new bot with GramIO in minutes. You should already have Node.js, Bun or Deno installed.

Obtain your bot token

First, create a bot and get a token. You can do this using the @BotFather bot.

Send the command /newbot and follow the instructions until you receive a token like 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw.

Scaffolding the project

This command will help you create a project with GramIO the easiest way.

bash
npm create gramio@latest ./bot
bash
yarn create gramio@latest ./bot
bash
pnpm create gramio@latest ./bot
bash
bun create gramio@latest ./bot
bash
TODO:// Deno is supported but not in scaffolding

Supported environment

The environment can work together

When you select ESLint and Drizzle, you get eslint-plugin-drizzle

Manual installation

To manually create a new bot with GramIO, install the package:

bash
npm install gramio
bash
yarn add gramio
bash
pnpm add gramio
bash
bun install gramio

Setup TypeScript:

bash
npm install typescript -D
npx tsc --init
bash
yarn add typescript -D
yarn dlx tsc --init
bash
pnpm add typescript -D
pnpm exec tsc --init
bash
bun install typescript -D
bunx tsc --init

create src folder with index.ts file and write something like:

ts
import { 
Bot
} from "gramio";
const
bot
= new
Bot
("") // put you token here
.
command
("start", (
context
) =>
context
.
send
("Hi!"))
.
onStart
(
console
.
log
);
bot
.
start
();
ts
import { Bot } from "jsr:@gramio/core";

const bot = new Bot("") // put you token here
    .command("start", (context) => context.send("Hi!"))
    .onStart(console.log);

bot.start();

and run the bot with:

bash
npx tsx ./src/index.ts
bash
bun ./src/index.ts
bash
deno run --allow-net ./src/index.ts

Done! 🎉

Now you can interact with your Telegram bot.