Solana Dev 101 - Making a Solana Discord Bot with Webhooks
Introduction
Interested in creating a Discord Sales Bot for an NFT collection? This blog post will guide you through setting up a Discord Sales Bot using Helius Webhooks.
Setting up the Discord Webhook
To set up the sales bot on the server, navigate to the Server Settings. Remember, you'll need admin permissions to do this.
Select Integrations from the menu:
Click New Webhook and adjust the settings as you see fit:
Make sure to copy the Webhook URL, as it will be needed when we set up the Helius Webhook.
Setting up the Helius Webhook
Head to the Helius Dashboard and select the webhook section on the left. Once there, you can add a new webhook. Ensure you keep the network and webhook type the same as shown in the image, which should be Mainnet and Discord, respectively.
We add "Discord" as the Webhook type because it will format the transaction message according to the transaction and relay it directly to Discord without requiring you to write any code. You can choose which types of transactions you want to include. In our case, select NFT_SALES, as we'll only allow NFT sales to be sent.
The webhook URL will be the URL you previously copied from Discord. Keep this tab open, as we'll need to add the appropriate addresses into the Account Address field that the webhook will monitor.
Adding Account Address
We’ll start from an NFT, keep in mind some NFT collections may have been created from a different standard, which would change these steps. Starting from a Solscan link pointing to an NFT(example below):
Select the Metadata section, and scroll until you see the Creators property. From the array, select the address with a share value of 100. You may see one or more creators, but usually, only one creator will have a share value of 100. Copy this address and return it to the Helius Dashboard. In this case, the address is HAryckvjyViFQEmhmMoCtqqBMJnpXEYViamyDhZUJfnG. Copy and paste it into the dashboard.
Once you hit confirm, you're done! When an NFT is sold from the collection, you should receive a webhook message like this:
Conclusion
In this tutorial, we learned how to set up a Discord Sales Bot using Helius Webhooks. With this bot, you can easily stay updated with live NFT sales of your favorite collection. Discord's webhook feature removes the need for writing custom bot code, making it easier for everyone to get started. If you wish to build a Telegram Sales bot, you can refer to this tutorial. We hope you find it useful! If you have any questions or feedback, please don't hesitate to visit Discord.
Thank you for reading!