A (very quickly put together) bot that monitors Opensea sales for a given collection & then posts them to Twitter.
If you find this script/repo useful for your project, any ETH/token donations are greatly appreciated ๐
Ethereum Address: 0xDCA88f66CEc8972D23DE7d5e69c40E087C92132f
-
Heroku Account
Once you have been granted access to a Twitter Developer Account, created a project there (make sure it has both read/write ticked) + created an account on Heroku
-
Clone/Fork/Copy this project to your local public/private git repo
-
Create a new Heroku app, link up your Github repo to it so you're able to push commits up and see builds happening in Heroku.
-
Log in to the Twitter bot account, then use Twurl to authorize the app & also to retrieve the access token & access key
-
Make sure you are using
worker
dynos and notweb
dynos - can set this in the CLI your project with:
heroku ps:scale web=0
heroku ps:scale worker=1
In the Settings section of your Heroku app you'll see a Config Vars section. Add the following config vars:
- CONSUMER_KEY - Your Twitter App's Consumer Key
- CONSUMER_SECRET - Your Twitter App's Consumer Secret
- ACCESS_TOKEN_KEY - The Access Token Key of the Twitter Account your bot is posting from
- ACCESS_TOKEN_SECRET - The Access Token Secret of the Twitter Account your bot is posting from
- OPENSEA_COLLECTION_SLUG - The OpenSea collection name you wish to track (e.g.
cryptopunks
)
By default this runs every minute but can easily be changed (might be advisible to run it less often if you have a "free" tier Heroku instance).
In the tweet itself I am including an image of the item that was sold (you can easily comment this out and just preview the item on OpenSea if preferred), the name of the item, the price in both ETH & USD, an external link if one exists + a couple of hashtags. Check out the OpenSea Events API and include whatever extra properties you'd like (such as seller/buyer addresses etc.).
If you are having trouble setting up your Twitter Developer project, Heroku project etc. the following resources may be of use
This code is licensed under the ISC License.
Please include proper attribution if you fork or modify this project in some way. Thank you!