SQLBot - Why I Built a Slack SQL Bot.


Share this post:

Who Needs a Slack SQL Bot?

Why Start SQLBot?  Because I NEEDED it to do my CEO job well (and I hate wasting time!)

Let me tell you a story.  Or perhaps a couple, I tend to get wordy.  

I'll tell you two stories:

1. Why I started SQLBot (random trivia item: a Josh Pigford tweet string pushed me from idea to action to build it, see the tweets below

2. How SQLBot makes me a better CEO

Let's start with number two first.   I know that's the wrong order.  Keep reading anyway.

SQLBot makes me a better CEO.  How?

Easy - brutal honesty.  

SQLBot makes sharing a company's brutal honesty dead easy.

What's so great about brutal honesty?  

Do you reeeeeaaaaally want to know if those pants make you look fat or if your breath could knock a horse out cold?

Nothing helps a company focus on what's more important than brutal honesty.   Do co-workers ever ask:

  • Where's revenue at?  
  • How many leads did we have today?  
  • How does that compare vs. last week?    
  • Are customers happier this month than last?
  • How can we get this report every day?

Looking at those numbers every day makes you focus on improving them.  What you measure you manage.

You know what's hard about brutal honesty?  

No one likes bad news!  

Raw, unvarnished truth sometimes can slap you in the face and shout at you, "wake up you jack@ss!  this is a problem!"   Eeeesh.  Who enjoys that?

shouting
Why am I shouting?!

You know what people do when things make them feel uncomfy?  

They stop doing it.   

I plead guilty to this charge, especially early in my years as a CEO. 

People LOVE good news.  I do!   I love sharing good news as a CEO.  Teammates cheer, people post fun emoji's into Slack, and morale jumps a notch higher.  If your office holds a kegerator someone may say, "hey, let's sip on a delicious beer to celebrate!"

beer
Now that tastes great!

As a company or team leader, how can you make sure your team pays attention to not only the good news, but the ok news and the bad news too?   I learned an easy trick (or "hack" if your age hasn't crested 35 yet).

Here it is . . . force yourself to share it by scheduling it.  

It's that easy?  Really?   

Yes.

Schedule it.   Automate it.  

Do it now.

At my last four CEO gigs (a lot, I know) - MDHearingAid.comScripted.com, EarthClassMail.com, and HomeFinder.com (and MovingCompanyReviews.com, the startup we launched there), group chat ruled the roost as our go-to communication tool.  Slack for the last two, Hipchat (who remembers that those halcyon golden days of our youth?) at HomeFinder.  I found that if I scheduled important numbers to publish every day or every week into Slack/Hipchat, people paid attention to them.  Imagine that!   

Scheduling reporting of your important numbers takes the stress away of manually sharing them.  

It literally takes the stressful action out of your hands.  

Automating reporting of your key numbers makes them magically appear every day.  No more sweating over your mouse waiting to hit send, with the dread of peoples' reactions crawling up the back of your neck.  Instead you turn your computer on each morning and bam!, the numbers greet you.    Hello!  Good morning! Look at these numbers!

magic
It's Magic!

Now your job is to provide context and leadership.  

Sharing numbers every day keeps everyone up to speed with the true health of your business, good or bad.  Employees crave information.   You can either give it to them or they can invent rumors based on what happened on last night's episode of Bachelor in Paradise (can you believe what Paulie said?) 

When they see what's truly going on, their thoughtful questions and suggestions may surprise you.   

Simple huh?   Absolutely!  It works!  Don't make them wonder how many hearing aids you sold yesterday, show them!

Follow the recipe to bake this scrumptious cake.

How can you chart a path out to a better place if you don't know where you are now?   Set up some daily or weekly reports.   

Did you do it yet?  Do it.  Seriously.  Now.

Now on to why I started SQLBot in the first place.

Why did I Start SQLBot?

Easy - to make me a better CEO!   You read the first part above.   Sharing company performance data, good or bad, pays off handsomely in employee engagement, trust, and helpful conversations.   

You know what else I learned throughout my career?  

Ease of use equals use.  

Put another way - if you find it hard, you'll stop doing it.  If you find it easy, you'll keep doing it.  Whenever I faced regular important things that stressed me out (e.g reporting yesterday's churn, calling upset customers, putting pants on in the morning) I found myself doing them for a while then slowly letting them slide.  

Human nature herds us to activities we find pleasing and away from stress and draining work.   That's why I found myself months into a new CEO job still not knowing our key numbers.  Horse puckey!   I stink!

that-stinks
Ewww, stinky!

Before SQLBot I pushed myself through the following code gymnastics to get data into Slack (assuming my app lived on Heroku):

  1. Created a hubot slack bot on Heroku
  2. Cranked out some sweet SQL using Heroku's amazing dataclips feature (next to Stripe Sigma, Heroku Dataclips rank as my favorite SQL tool)   
  3. Wrote a hubot coffeescript command to hit the dataclip url, read the data, format a message, and dump it out into Slack
  4. Tested a bunch locally
  5. Accidentally pushed to the main Hubot repot and shared important company passwords (yes, I am terrible developer and yes, I acually did this once)
  6. Received a frantic text and get yelled at by my tech team, begged forgiveness, and deployed to the correct repo.  Then I laughed at (with) with them when they did the same thing a week lat
  7. Deployed to Heroku
  8. Wowsers!  My muscles ache just thinking about all that work.

While that recipe delivered awesome reporting, it took too much time & efffort to create a new report.   I never figured out how to schedule it either (yes, I realize I am lazy and a terrible developer).   

Wait!  The recipe above only works for data hosted on Heroku, so it left me high and dry when data sat anywhere else.  Like when hosetd a SQL Server database in random datacenter and another hosted on Azure.

And SQLBot came to life.  

it's alive
It's Alive!

I wanted an incredibly simple way to put in a database connection, add a SQL report, and publish the results to Slack.  

That's it.  

Simple.  

Fast.  

Efficient.   

I love me some Upwork, so I threw a job out there to see if what I wanted could be done.   If I remember correctly, the description went something like, "Create a simple rails app hosted on Heroku that can query other databases using ActiveRecord."

The proof of concept showed *GREAT SUCCESS*, so I added some dashes of Devise, Bootstrap, a nice theme, and baked them in the oven for 30 minutes at 400 degrees.  

bake
Let's bake this pizza!

Originally we launched SQLBot as part of EarthClassMail, but they were nice enough to give it to me when I left (thanks!)

Do you know what I love about SQLBot?  It saves tech teams the time of doing any work, and lets SQL pros crank and provide value.  Three cheers for the SQL pros out there!

Thanks for reading this far.  Give yourself a gold star and buy yourself an expensive latte.

Now that you count as one of the few that actually made it through this novel, take a gander at what's next in our SQLBot plan:

  • (maybe) A Zapier app where you hook SQLBot reports into any Zapier actions
  • (definitely) The ability to email out scheduled report results and include the csv file of the results
  • (maybe) Showing results as an image in Slack instead of a text table, since Slack table formatting doesn't exist
  • (definitely) Actually implementing billing so we charge people money.  That's right, everything is free for now.  Shhh . . . don't tell anyone!

Want to make sharing & scheduling reports into Slack dead easy?  Give SQLBot a try today with our free trial.

Shout outs that helped make SQLBot happen: