Close.io Email Reports
A python script that will send a daily sales email report to the users in your Close.io organization. Follow the below tutorial to automate the email reports with a $5/month DigitalOcean droplet.
What's Included The Report
- Individual stats [daily, weekly]:
- Calls
- Call duration
- Opportunities created [amount, value]
- Opportunities won [amount, value]
- Team stats for admins [daily, weekly]:
- Calls
- Call duration
- Opportunities created [amount, value]
- Opportunities won [amount, value]
- Leaderboard stats [weekly]:
- Calls
- Opportunities created [amount, value]
- Opportunities won [amount, value]
Options
- Send a total team report to the admin(s).
- Ignore certain members that don't want to receive the emails.
- Send an email to someone outside of your Close.io organization.
- A testing mode so you don't spam your team during setup.
What You'll Need
- Close.io API key and organization ID with admin access.
- A Mailgun account to send the emails to your team.
- A DigitalOcean account to run the daily email via a cron job.
Running The Script Locally
- Clone the repository to your local machine.
- Navigate to the folder via the command line:
cd closeio-emailreports
- Initiate a virtual environment:
virtualenv venv
- Load up the virtual environment:
source venv/bin/activate
- Install the necessary dependencies:
pip install -r requirements.txt
- Open up the
_keys.py
file in your favorite text editor. - Add your Close.io API key, Close.io organization ID, Mailgun API key, and Mailgun domain.
- Open up the
_settings.py
file and follow steps 1-6 to fill in the appropriate information. - Run the script from the command line:
python email_reports.py
. - If you kept
testing_mode = True
in_settings.py
, you should receive email reports for each person in your organization. You will also receive the admin team report. - To go into live mode, change the
testing_mode
toFalse
in_settings.py
. - Booyah!
Automate The Report With DigitalOcean
- Sign up for DigitalOcean and create a droplet:
$5/month - 512MB NY3, Ubuntu 14.04 x64
- Once the droplet gets created, DigitalOcean will email you a root password that you can log into.
- Get on the command line and login to your droplet using the password:
ssh root@100.200.300.40
- Once logged in, you should see
root@YOUR_DROPLET_NAME:~#
. This is good. - Type
cd ..
to get into the root of your droplet. - Install Git so you can clone the repo:
sudo apt-get install git-core
. - Install setuptools so we can get pip installed:
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo python -
- Install pip:
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python -
- Clone the repo:
git clone https://github.com/nickpersico/closeio-emailreports.git
. - Get into the new repo by typing
cd closeio-emailreports
. - Install the necessary dependencies:
pip install -r requirements.txt
- Set up your
_settings.py
and_keys.py
file. - See steps 5-10 above. I recommend opening these files using nano:
sudo nano _keys.py
. - nano can be tricky for beginners. The keys are
CTRL + O
to save, andCTRL + X
to exit. - Now we need to automate the script to run once a day. We'll do by typing
crontab -e
. - Arrow down until you get to blank space below the comments, and now we'll add a cron job.
- I like my daily email reports to come out at around 6:30PM Monday-Friday.
- The cron job command for that is
21 18 * * 1-5 python /closeio-emailreports/email_report.py
- Hit CTRL + O, Enter, and CTRL + X to save. You should see a message list this:
crontab: installing new crontab
- You'll know it worked if you & your team received an email at 6:30PM (local time on the server)!
Please Note: I highly recommend testing the script in testing mode prior to setting up a cron job. The last thing you want is to spam your co-workers when setting this up!
Questions? Need a custom report?
Send me a [note](mailto:nicklpersico@gmail.com?subject=Close.io Email Reports) or a tweet. Pull requests welcome!