Greed – Telegram Shopping Bot

Greed is an e-commerce bot running on telegram. It allows users to chat with it to purchase goods and pay for them in bitcoin


Source Code
Youtube Video


  • Telegram Account
  • Linux System
  • Python 3.8
  • Git

Initial Setup

The code repository of the Telegram Bot integrated with Blockonomics payments is available on Github here. The step by step instructions on how to integrate Blockonomics payments is provided in the README of the repository, for installation of the greed customizable bot you have to visit the main greed project repository’s README file and follow the steps.

Creating Bot Token

The Telegram Bot token can be obtained by creating a new bot using the BotFather in Telegram. Search for BotFather in telegram and start the bot, it will provide various options about managing and creation of bots, create a new bot using the /newbot command. It will ask about the details of the bot like Bot name,username fill it accordingly. Once the bot has been created the API TOKEN for the bot will be provided. Copy the token and provide it in the config/config.toml file in the token field.

Integrating Blockonomics

Once the bot token has been specified, the bot can be started by using the python -OO . To integrate bitcoin payments with the bot an API_KEY is required from the Blockonomics, you can find the API_KEY in  Blockonomics Merchants > Stores, if you don’t have an account create one it is completely FREE. Copy the API Key and paste it in the Blockonomics section API_KEY field in config/config.toml, below the API_KEY field there is a SECRET_KEY field which is a custom string provided by you. Remember the SECRET_KEY which is created by you, it will be used for CALLBACK_URLS.

Setting Up Callback URL

HTTP Callback URL’s are responsible for the verification of the payment and payment status updation. Whenever a payment changes status Callback URL’s are called with the updated status. Now let us set up a Callback URL for our website. For setting up Callback URL you need to deploy your bot in the live internet, for that we have some options like Ngrok , Heroku etc. Start the start the bitcoin callback listener on port 5000 python3 -OO, In another terminal start ngrok on port 5000 ./ngrok http 5000 or ~/ngrok http 5000. Now copy the Forwarding URL from ngrok. For setting up HTTP Callback you need to have a store in Blockonomics website, you can create one from  Blockonomics Merchants > Stores in the HTTP Callback URL field of the field provide your copied URL from ngrok followed by /callback?secret=SECRET_KEY here the secret key is the key which I told you to remember, it can be found in the config/config.toml file.

Start Testing your Bot

Hurray! after completing these steps you have successfully created a Telegram Bot Shop Which accepts Bitcoin Payments as well. Start your bot in telegram, if you can’t find your bot you can find it using BotFather using /mybots command which will list all your bots. You will be manager of the bot, you can add Products from the Manager Account, if you want to check the working of Bitcoin payments you can Switch to the Customer Mode from the panel and add funds to your wallet using BITCOIN. For Testing purpose you can make use of the Log/Test Bench provided by the Blockonomics for making mock payments. In Test bench, Select the store provide the BTC amount and Bitcoin Address copied from the Telegram Bot Shop, select any of the payment status for testing. Once the test payment is sent you can see your wallet will be funded with the corresponding BTC amount.

The End

We have Successfully created a Telegram Bot Shop with the help of greed ( Customizable Bot Shop) which will accept Bitcoin Payments and we also learnt how to configure the Callback URL for the Store, make test payments for the Store.