UX, mobile, entrepreneurship

Monitoring a Server With the Telegram API

Some servers behind Podrover are just workers and do not run a web application, so I can’t use Pingdom and the like to monitor them.

I could use some library like Monit but honestly I didn’t want to install one more thing on the server and I like to exploit push notifications when possible.

I am already monitoring some behavior of my DB servers via Slack. When some key activity is performed a message is sent to a private Slack group, and I get a notification on my iPhone. I didn’t want to clutter that monitoring channel with more notifications about workers, plus I wanted to learn something new so I gave Telegram a shot. It turned out to be pretty easy.

I created a bot, then I created a new group (conversation) to which I added the bot and myself. A script on my servers tells the bot to post a message in that group. That’s it. To post to a group you need its id, which is a little tricky to find it. You need to fetch updates via the getUpdates API, like this.

curl -s \
  -X POST \

This returns something like

  "result": [
      "chat": {
        "username": "funkyboy",
        "first_name": "Cesare",
        "id": 123 // <- this ID

That id field within the chat object is the one you need. Now you can post messages to that specific group:

curl -s \
  -X POST \
  https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage \
  -d text="This is a message from the bot" \
  -d chat_id=123

You can schedule such a script on the server via Cron. On my servers I use a Rake task like this

task :dude_i_am_still_alive do
  require 'socket'
  require 'httparty'
  host = Socket.gethostname
  body = {:text => "#{host} is alive", :chat_id => 123}
  response = HTTParty.post('https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage', :body => body)

scheduled via whenever.

It’s still not ideal to me, because essentially I should worry when I am NOT getting a notification but for now it will do. After all a dead machine can not tell you that it’s dead :)

If you are using a different tool to solve this problem, let me know on Twitter.

Drew Wilson Is Crazy

I mean crazy good :)

Yes, I could have used a pencil/pen and paper (my preferred method) but I didn’t have any in the room.

So what do you do when you don’t have pen and paper handy? You build a Mac application in 24h!

Kidding aside, I think the NSF should create a fund to investigate how Drew can produce good stuff so quickly. The most important takeaway is:

This turned out to be a great learning experience for me and an invaluable source of confidence in my journey in Mac development

Exactly. Feel down because you can’t deal with a platform? Ship something small and simple built on that platform. It will boost your morale and confidence.

Kudos to Drew.

The Spite Machine Doesn’t Look Back

Pattern: regular dude/gal does something relevant and gets “famous”. Three options:

  • ignore
  • envy
  • take inspiration

The first option is the hardest nowadays. Big publications might write about the success of dude or gal, not to mention appearances on podcasts. Either you are on vacation and totally disconnected or chances are that you will hear about that story. It’s up to you to try to ignore it and keep walking on your path, but it requires some effort to not get distracted, at least to me.

The second option is the most popular. It’s alimented by some of the following thoughts:

  • why not me?
  • It could have been me
  • I put up with the same effort and I am nowhere near that kind of success
  • He/she is part of my “tribe” but saying things that don’t represent my tribe.

These thoughts lead to:

I have to say something, I have to attack, or join the existing group of attackers. Tweet, write blog posts, criticize, shout out. This will bring me attention, followers, it will bring me the success I deserve.

If you want followers say something controversial or negative about someone or something. You will see a spike in the number of retweets, I can almost guarantee you that.

Before you start thinking I am a sinless monk I am guilty myself. One of the most read posts on this blog is a negative opinion about RubyMotion.

Now think about it for a second. What do you share with your new followers? The dislike about someone or something. How fertile is that common ground?

The third option, taking inspiration, is the most boring. There’s no public drama. Where are the hatred tweets and blog posts? I am not getting any followers from this story! There’s nothing in it for me!

You are right, there’s nothing in it if you look just a few days back. But if you enlarge your horizons a bit there’s a lot to take inspiration from. For me it starts with a simple question:

what did this dude/gal do for the last ten years?

Look there and you’ll find your inspiration.

Playing Darts

Just yesterday I wrote that your business is about them. This is extremely evident if you are building devices and software for customers with disabilities.

Yesterday Kevin told me he was on TV. I met Kevin at Cocoaconf. We have been in touch since then. He’s blind since birth. He helped building and testing BrainPort V100. A camera mounted on glasses depicts a scene on a pad which the user keeps on the tongue and those stimuli are processed by the visual cortex.

Yesterday Kevin was on Fox 47 to explain the device. Here’s the video. Just skip to 1:35 where Kevin … plays darts!

This is what technology is meant for: opening doors and possibilities.

I look forward to the next time I am around Chicago to play darts with Kevin.

Your Business Is About Them

I am an avid listener of the Hack the Entrepreneur podcast hosted by Jon Nastor. A few weeks ago he interviewed Derek Sivers.

There’s a quote still stuck in my head.

The success of your business has nothing to do with you and what you want, your personal passions and preferences … this isn’t about you, your business is about them and their needs.

Passion can be a driver, no doubt. You feel better when it flows in your veins, you are more motivated and probably more productive.

But passion is also “something internal” and might keep the spotlight on you, whereas it should stay on your customers.

I learned this lesson when I was a bartender. Your job is done not when you think you made a great espresso but when you see satisfaction on the face of who drinks it.

Stu Green on SaaS Startups

My friend Stu is posting like crazy about the lessons he learned building SaaS startups. It’s very good stuff. Lesson #1 is: breathe.

Control the Narrative

The App and Play stores have turned out to be exceptionally poor places to run a software product business for most developers.

We have been saying this for quite a while. Check the presentations at iOS/Mac conferences in the last year and you’ll find at least one occurrence of the word “Indiepocalipse”.

There are people, even solo developers, that make a living or a good secondary income off the App Store. I meet them at conferences, I talk to them, they are real. They don’t blog and they don’t podcast. They found a niche with a problem and they built an app to fix it. But they are a fistful. You can build a business on top of the App Store, but we all know it’s hard.

Apple and Google both benefit from having apps be as cheap as possible.

Definitely true, but there’s another aspect: controlling the narrative. When you build a product deeply rooted in the App or Play store you don’t control the whole narrative and this can be a problem.

Quick example. Friends of mine were building an app related to a big event. The event happened a few days after the public release of iOS9. You can’t postpone the event and you can’t ask Apple to change its plans. What do you do? You don’t want to be in that situation. Do you target iOS8, iOS9 both? There are so many possibilities to screw up. Needless to say, some bugs where related to iOS and were fixed in 9.0.1, which was released after the event.

Maybe you started building software because you felt there was freedom in that field. Now you are caught between fires, you will and the will of the people behind the platform you adopt. Apple and Google are business partners, like it or not. They call executive meetings and they don’t invite you. They make decisions and they don’t ask for your opinion. They control the narrative, especially Apple which oversees the full stack, from hardware factories to software distribution stores. You have to follow along. Were you planning that cool vacation in mid September? You might want to postpone. …

To give you a counterexample: Github chose when to upgrade to the new version of Rails. Was it painless? Probably not, but they had the luxury of choosing when.

In the Cocoa community we have a cyclic discussion about dependencies. Should I use Cocoapods? Should I trust that third party library written during the weekend by somebody in Alabama? Well, the App Store a dependency, a pretty relevant one.

Does this mean you should not build apps? No, it means you should get acquainted with your business partners. They are controlling their narrative. As long as your script fits theirs you are fine. Do you want to run you own show and write your script from scratch? You should probably look elsewhere or be ready to compromise.

Hit me on Twitter, I love discussing this topic.

Pitching a Product Is a Bit Like Dating

These days I am getting in touch with some podcasters to see if they’d like to join the beta of Podrover. It feels a bit like dating.

I have been out of the dating scene for quite a while but usually my approach was “can I buy you a drink?”. I always thought it was the simplest and less “compromising” question. I feel it’s also easy to answer, although once I got an “I don’t know”. I am not kidding.

Most of the resemblance between pitching and dating is in the variety of answers though. While dating I got the following answers:

  • yes
  • no
  • why not?
  • sure
  • gotta go now, maybe tomorrow
  • uh
  • I don’t know (I am still petrified by that answer)
  • Get the hell out of here
  • kjahsd?12=klja; (she was drunk)

While pitching Podrover the variety is still pretty interesting:

  • Yes
  • No
  • Yes but …
  • I don’t care
  • Oh shit, yes!
  • I am not your target user
  • Can I have an account also for my co-host?
  • I’ll pass it to our management team
  • Great idea! I signed up

I feel it’s not worth asking myself: how is it going? Honestly I am happy with the responses I am collecting. Much like in dating, it’s a matter of finding the “right one for you” and “the one you are right for”.

International Podcast Day

I love podcasts. They are with me when I walk, in the bathtub, when I cook and before sleeping. Podcasts are a revolutionary medium and also a means to build a relationship.

Even if you have never met the host of a podcast, don’t you feel you already know him/her a bit? As a host, didn’t you notice that people approach you more easily when you meet them face to face, for example at conferences or meetups? That’s the power of the voice. You have been the voice in their ears, they know you.

There are many ways in which you can celebrate International Podcast Day:

  • Spread the word about a podcast you like
  • Say thank you to the hosts you like the most
  • Leave a review on iTunes/Stitcher
  • Stop someone on the street and teach them what is a podcast
  • Grab your mic and record a new episode of your podcast
  • Start a new podcast!

Check out the official web site for more initiatives.

Every day should be podcast day, but having an official day can’t hurt.

P.S.: To celebrate I am giving away a full year subscription to Podrover. If you run a podcast you might be interested.

Writing Code in Entrepreneur Mode

Here is it, innocent Ruby code:

t1 = "2015-08-27T11:53:00-07:00"
t2 = "2015-09-16T12:33:36-07:00"

t1 < t2 #true

Some of the DB queries in Podrover involve time. For example: “get all the reviews since yesterday”. During the prototyping phase I always worked with strings and when I came to build that query I still used strings. As long as the format (and the time zone) is the same it should work. If you have a case in which it doesn’t work let me know and I’ll update this post.

This is code written in “entrepreneur mode”. Quick, dirty but working. And I am still proud of it, particularly of the way I cut corners.

But the developer side of me took over for a few minutes and I showed the snippet to Ben Scheirman. It took him probably ten words before saying “gross”. And he is right. It is gross. But it took me five minutes to conceive and write it.

In the end Ben talked me out of it and I spent around 2 hours refactoring my code to move to DateTime, as it should be.

The developer side of me thinks I did the right thing. The entrepreneur side of me thinks I could have spent those hours talking to more customers. Both sides are right. It’s my job to balance them. It’s not easy but I am confident I will succeed.

Some “guides” I keep handy.

  • Judicious Use of Shitty Code
  • “Choose the bugs you want to ship with your release” (heard a long time ago, don’t remember who said it)
  • A coin to flip when I wake up, to decide who should dominate during the day, the developer or the entrepreneur.

If you struggle with similar issues let me know on Twitter or even better write a blog post about it.