How to create a TelegramBot using ZettaBlock GraphQL API
Soham
Posted on January 4, 2023
To create a bot using the ZettaBlock GraphQL API, you'll need to follow a few steps. First, make sure you have an API key and access to the ZettaBlock GraphQL endpoint where you will get API ID and API Key which you need to input in the .env file. Then, you'll need to create a bot on Telegram and then choose a programming language and a framework to build your bot with. Some popular options for building bots include Node.js, Python.
Follow the steps shown below to make an awesome Telegram Bot:
- Make a Data Query
- Create an SQL Query to fetch Solana tokens on the Mainnet-Beta(Here we are building a Solana Token Tracker Bot)
SELECT
"name",
"symbol",
"decimals",
"token_authority",
"supply",
"type",
"address"
FROM
solana_mainnet.token_metadata
LIMIT
20
- Create API to Query the data. Indexed the data by selecting the name, symbol and supply field
- Get your API Key, API ID, Bot token and Hop on to Github
Run following command
npm i
Add API ID, API Key and Bot Token in .env.example and rename the file to .env
Now, run the following command and you're good to test your bot on Telegram
node index.js
Posted on January 4, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024