- Author had a File in an Envato Bundle
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 10 000 and 50 000 dollars
This is a quick PHP script I threw together which will check a users balance, and send them a direct message via Twitter informing them of the change.
EXAMPLE OF TWITTER NOTIFICATION : “Your new Envato Marketplace balance (account: danharper) is $205.65 (a difference of $10)”
Users can be added or removed using the manage.php page which inserts the user into a database table.
- Setup a Twitter account to use for the notifications.
- Create a database & a table named ‘users’ using the SQL query below:
CREATE TABLE IF NOT EXISTS `users` ( `id` int(5) NOT NULL, `username` varchar(60) NOT NULL, `apikey` varchar(120) NOT NULL, `twitter` varchar(45) NOT NULL, `balance` varchar(10) NOT NULL, `error` varchar(10) NOT NULL, PRIMARY KEY (`id`) )
- Enter your database and Twitter settings into conf.php
- Run manage.php and add a new user to make sure it works.
- Run execute.php. The file runs through all users in the database, and checks their current balance.
- Run execute.php automagically at set intervals (eg. hourly) using a cron job (Google it)
- The user must be following the notifications account on Twitter to receive the updates.
- You can test it out by manually changing the balance in the database.
- I give no guarantee that this app is stable, and is definitely not production-ready. Just a test, really.
- Do with this code what you like.
- Don’t hold me responsible if your server transforms and takes over the planet while running the script (sorry).
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 10 000 and 50 000 dollars
Just updated the files to be compatible with more web servers (now using cURL to retrieve the API .)
Also, I forgot to included auto_increment in the SQL query above; use this instead:
CREATE TABLE IF NOT EXISTS `users` ( `id` int(5) NOT NULL AUTO_INCREMENT, `username` varchar(60) NOT NULL, `apikey` varchar(120) NOT NULL, `twitter` varchar(45) NOT NULL, `balance` varchar(10) NOT NULL, `error` varchar(10) NOT NULL, PRIMARY KEY (`id`) );
Don’t have a webserver? I’m now running a hosted version at http://danharper.me/salesnotifier/ 
(I hold the right to take down the hosted service at any time if problems occur.)
