# How to create your own Notification Bots > For web3 users who wanna track certain contracts/addresses **Published by:** [hangytong](https://paragraph.com/@hangytonggmail.com/) **Published on:** 2024-06-07 **URL:** https://paragraph.com/@hangytonggmail.com/web3-noti-bot ## Content Introduction Now adays with so many token launches every now and then, it gets more and more messy to keep track of the tokens that you want to focus on. Not only that, you also have certain addresses that you want to keep track of to see what they are doing. If you are a typical web3 user that believes that certain tokens can pump because certain addresses sends/receives certain amount of a particular token, then you would probably wanna use something like https://dexscreener.com/search to keep track of them. However, with the reasons above it is impossible to keep track of them and let alone spoiling your eyes while gluing them on the screen all day. Modern web3 tactics such as using https://platform.arkhamintelligence.com/alerts can automate all these for you. However, it might not be suffice as it does not cover certain less known chains. In this article, we explore how we can create such alerts on our own. Requirements First you would need a decent amount of python knowledge. We will be making use of APIs to help us with the bot, thus you need to be familiar with using the requests library. Next, you would need an API key from the explorer that you would like to pull the data from, since you are going to make API requests. Each chain has their own explorer and API documentations, so you would need to be mindful of that. Next, you will need to have the keys to post to a particular channel. Either telegram or slack. In telegram you will need to make use of botfather to get the key. In slack you would need to create a workspace and a bot with chat:write authorization to generate the key. I used slack because its easy to use. In our code we just need to hook up to their API to post messages into our slack channel. Lastly you will want to host your code in a server. you could use any cheap sever as this would not require much computational power. you could rent a cheap one from https://contabo.com/en/ Steps Before we dwell into the technical, we first need to get a structure of the entire flow. Below is the flow of the bot that we are going to create: Now let's move on to the steps. I would be using an example i have created to track $DAMOON on the Cronos chain to certain CDC addresses. First we have to determine the token contract address and the wallets of interests that we want to track. So in this case, we have the ticker $DAMOON <0x431469cE9D70A5879e959bF15cFFAD003dC7f69F> in which we can verify its token address from the Cronos explorer https://cronoscan.com/. We have also identified the wallet that we want to track <0xBfc21b993ed75d0969781D703A0896064bB7a532>. Next we determine the conditions at which we want our bot to send the notifications, in which in this case we want the bot to send notification when the address sends/receives more than 50k $DAMOON token. Note that you need to go to the Cronos Explorer to see how many decimals this token has (18 in this case) via the contract. Dependencies import requests import pandas as pd from datetime import datetime from decimal import Decimal import timeFor the Cronos Explorer API, https://docs.cronoscan.com/api-endpoints/accounts, you can read its documents to see what parameters you need when making a request to the API. For us, we are interested in :Get a list of 'CRC-20 Token Transfer Events' by Address. you can see the request parameters needed and the response you will get. For the Slack API, after you have created your bot, all you need to take note of is finding your channel ID in the slack app in which you added your bot on and your API key. If you have multiple wallets and contract addresses you want to track, it is best to make use of dictionaries/lists to loop through them. With that, we can write the script as below:api_url = "https://api.cronoscan.com/api" api_key = "" #write your Cronos API key here slack_api = "https://slack.com/api/chat.postMessage" slack_token = "" #your slack API key slack_channel_id = "" #your slack channel's ID slack_headers = { "Content-Type": "application/json", "Authorization": f"Bearer {slack_token}" } contract_addresses = {"0x431469cE9D70A5879e959bF15cFFAD003dC7f69F": 50000000000000 } #tokens and the tokens' value you want addresses = ["0xBfc21b993ed75d0969781D703A0896064bB7a532"] #CDC addresses list_of_tx = [] while True: for contract, contract_value in contract_addresses.items(): for addr in addresses: params = { "module" : "account", "action" : "tokentx", "contractaddress" : contract, "address" : addr, "page" : "1", "offset" : "1", "sort" : "desc", "apikey" : api_key } response = requests.get(api_url, params=params) if response.status_code == 200: print(f" {datetime.now()} : Request successful") data = response.json() df = pd.DataFrame(data['result']) df['value'] = df['value'].apply(lambda x : Decimal(x).to_integral_value()) if (df['value'].iloc[0] > contract_value) and (df['hash'].iloc[0] not in list_of_tx): list_of_tx.append(df['hash'].iloc[0]) df['timeStamp'] = pd.to_datetime(df['timeStamp'], unit='s') df.drop(columns=['blockNumber','nonce','tokenSymbol','blockHash','tokenDecimal','transactionIndex','gas','gasPrice','gasUsed','cumulativeGasUsed', 'input','confirmations'], inplace=True) #post noti to slack bot message = f"New transaction detected : /n {df.iloc[0]}" payload = { "channel": slack_channel_id, "text" : message } try: slack_response = requests.post(slack_api,headers=slack_headers,json=payload) print("Message posted successfully") except: print("Error sending message") else: print(f"Error: {response.status_code}") time.sleep(1) ## Publication Information - [hangytong](https://paragraph.com/@hangytonggmail.com/): Publication homepage - [All Posts](https://paragraph.com/@hangytonggmail.com/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@hangytonggmail.com): Subscribe to updates ## Optional - [Collect as NFT](https://paragraph.com/@hangytonggmail.com/web3-noti-bot): Support the author by collecting this post - [View Collectors](https://paragraph.com/@hangytonggmail.com/web3-noti-bot/collectors): See who has collected this post