DEV Community

Vansh Wadhwa
Vansh Wadhwa

Posted on

How to make a NFT Sold Notification Discord Bot

Want to get notified whenever a NFT from a collection is sold directly on Discord?
This is how you could do it:

Create an account on Chainbase
We will be using chainbase for the whole process so make sure to create an account on chainbase.

Get Chainbase API Key
Get a chainbase API key from here.
Note it as CHAINBASE_API_KEY.

Get a Chainbase ETH network API key
Get ETH network API key from here.
Note it as CHAINBASE_ETH_MAINNET_KEY.

Get chainbase data cloud API key
Get the Data Cloud api key by writing any SQL here and clicking Generate API.
Note it as CHAINBASE_DATACLOUD_API_KEY.

Clone this github repo

git clone git@github.com:vanxh/nft-sales-bot.git
# or using HTTPS
git clone
Enter fullscreen mode Exit fullscreen mode

Create a .env file and enter the API keys we created above

CHAINBASE_API_KEY="FROM THE STEPS ABOVE"
CHAINBASE_DATACLOUD_API_KEY="FROM THE STEPS ABOVE"
CHAINBASE_ETH_MAINNET_KEY="FROM THE STEPS ABOVE"
DISCORD_WEBHOOK_URL=""
Enter fullscreen mode Exit fullscreen mode

Install modules

yarn install
# or npm
npm install
Enter fullscreen mode Exit fullscreen mode

Update contract address in src/index.ts
Update this line with contract address of NFT you want to track.

const CONTRACT_ADDRESS = '0x0000000005756b5a03e751bd0280e3a55bc05b6e';
Enter fullscreen mode Exit fullscreen mode

Build the project

yarn build
Enter fullscreen mode Exit fullscreen mode

Run the project

yarn start
Enter fullscreen mode Exit fullscreen mode

You can find the repository for this post here.

Top comments (1)

Collapse
 
sloan profile image
Sloan the DEV Moderator

Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link. Doing so helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section.

If you choose to do so, you also have the option to add a canonical URL directly to your post.