Example of interoperability between a Web App, a Telegram Bot and a third-party API.
Important
tGO
is still in the early stages of development.
go install github.com/bastean/tgo/cmd/tgo@latest
Note
- We need to create an
.env
file where we have our own values defined.- In the .env.example.cli file, we can see the values that can be used.
- If we want only certain users to be able to interact with the bot to “test” it, then we must define their respective usernames in the
TGO_BOT_TELEGRAM_WHITELIST_USERNAMES
variable, otherwise anyone will be able to interact with it.
- If we want only certain users to be able to interact with the bot to “test” it, then we must define their respective usernames in the
- In the .env.example.cli file, we can see the values that can be used.
- Following these step-by-step guides we will get the required values for third-party services like
Telegram
andCoinGecko
.- "BotFather, creating and managing bots", we will get our authentication token for our
Telegram Bot
. - "Setting Up Your API Key", we will get our
CoinGecko
demo key.
- "BotFather, creating and managing bots", we will get our authentication token for our
tgo -h
_____ ________________
__ /_ __ ____/__ __ \
_ __/ _ / __ _ / / /
/ /_ / /_/ / / /_/ /
\__/ \____/ \____/
Example of interoperability between a Web App, a Telegram Bot and a third-party API.
Usage: tgo [flags]
-env string
Path to ENV file (required)
Note
- We must define our own
Telegram
andCoinGecko
values in the file .env.demo by modifying the variablesTGO_BOT_TELEGRAM_*
andTGO_API_COINGECKO_*
.- If we want only certain users to be able to interact with the bot to “test” it, then we must define their respective usernames in the
TGO_BOT_TELEGRAM_WHITELIST_USERNAMES
variable, otherwise anyone will be able to interact with it.
- If we want only certain users to be able to interact with the bot to “test” it, then we must define their respective usernames in the
- Following these step-by-step guides we will get the required values for third-party services like
Telegram
andCoinGecko
.- "BotFather, creating and managing bots", we will get our authentication token for our
Telegram Bot
. - "Setting Up Your API Key", we will get our
CoinGecko
demo key.
- "BotFather, creating and managing bots", we will get our authentication token for our
make demo
The system allows the user to register a “portfolio” of cryptocurrencies to perform different actions on it, such as consulting the market “prices” of the registered coins.
It is a simple monolith where CRUD operations are performed from the Web App and the Telegram Bot to the same database, this allows us to manage users from different applications.
git clone https://github.com/bastean/tgo.git && cd tgo
git clone [email protected]:bastean/tgo.git && cd tgo
-
Run
make genesis
Important
Before running it, we must initialize the following environment variable files:
- .env.example
- We will have to create a
.env.(dev|test|prod)
for each runtime environment. - In the .env.example.demo file, we can see the values that can be used.
- We will have to create a
In case we only want to run the Integration or Acceptance tests, in addition to having the .env.test
file, we must have the following files created:
- .env.example.test.integration
- Rename the file to
.env.test.integration
.
- Rename the file to
- .env.example.test.acceptance
- Rename the file to
.env.test.acceptance
.
- Rename the file to
make compose-dev
make test-unit
make compose-test-integration
make compose-test-acceptance
make compose-tests
make compose-prod
- Contributions and Feedback are always welcome!