Write a Telegram bot using IFTTT recipies

I want a simple and automated way to notify my wife I’m at the train station of our city, commuting to home. I know there are plenty of apps for that, but I already have an ongoing Telegram chat with her, so I created a Telegram bot that sends a message in that chat every time I’m in a particular area. How? Here the list of the different pieces to put in place:

  • Create a Telegram group chat
  • Create a Telegram bot
  • Enable bot to send messages to the group chat
  • Write an IFTTT recipe that activates the bot every time I (my phone) enter in a particular location

Just a side note: The same approach works also for other messaging apps that support bot integration and activation via webhooks. Even better for Slack, that has its own channel on IFTTT, so no need to deal with webhooks.

Create the Telegram group chat

Nothing to say here, if you already have Telegram, you know how to create a group chat between the people you want to notify. Even if the conversation is between me and my wife only, I created a groups chat and not direct message because also the bot needs to be included.

Create the Telegram bot

I followed the official documentation to create a Telegram bot, asking to BotFather for a new one, with name Lurch (oh yes, the name of my digital butler since my very first project of this kind during high school years), username YellowBot.


As you can see, BotFather returned a token to use while calling the Bot API. I also set Lurch profile picture using /setuserpic command.

I finally added the newly created YellowBot to the previously created group chat.

Enable bot to send messages to the group chat

Telegram exposes a convenient webhook for posting a message thru a bot: the sendmessage API. It’s as simple as making an HTTP call, with some parameters in the payload. Two of them are required, the chat_id and the message.

chat_id: as per documentation, “Unique identifier for the target chat, or username of the target channel (in the format @channelusername)“. So, the id of the group chat previously created. To obtain it, the getUpdates API can be used, using the following syntax (it’s important to change XXtokenXX with the token previously obtained by BotFather):

curl https://api.telegram.org/botXXtokenXX/getUpdates

Unfortunately, this call returns an empty json, because there are no messages for the bot so far:


Writing message in the group chat where the bot has been added doesn’t help, because of the privacy-mode activated by default for all the bots.  As per documentation, bots will receive only messages that start with a slash ‘/’ , so I wrote a test commmand like “/test”, but / + any combination of letters can be used. This time, the same call to getUpdates returns:

          "title":"YellowFamily chat",

So, the group chat_id is -235327410. As per documentation, a negative id refers to group chat, positive to private chat with a user.

At this point, it is already possible to send a bot message in the group chat, using a simple CURL command. I used a POST request and a application/json as content-type among the different ones available, so I formatted the payload accordingly:

curl -X POST -H "Content-Type: application/json" -d '{"chat_id":"-235327410", "text":"Hello world!"}' https://api.telegram.org/botXXtokenXX/sendMessage

obtaining a reply similar to

    "from": ....

The “Hello world!” message should also appear on the group chat, with the bot as sender.

IFTTT integration to send messages using the bot

IFTTT has one channel to trigger an action when the device is in a specific location (in my case, entering the train station) for Android and for iOS, but hasn’t a dedicated channel for Telegram (yet). Luckily, the Maker channel comes in handy: what it does is to make an HTTP call to an URL specifying the kind of call (GET, POST, UPDATE etc), the content type and the message payload (if any). The exact information required to activate the Telegram bot just created.

So, first step is to create a new recipe with the Android Location channel as “this” part. Once downloaded the IF app for Android on the phone and connected the channel, I selected the “You enter an area” trigger, selected the area of my interest and created the trigger

IFTTT location trigger

For the “that” part, I selected the Maker channel and “Make a web request” as trigger, using the following parameters:
URL: https://api.telegram.org/botXXtokenXX/sendMessage
Method: POST
Content type: application/json
Body: {“chat_id”:”-235327410″, “text”:”It seems Alfredo is in at Pavia train station”}

IFTTT Maker channelThat’s all. Once I’m nearby the train station, the bot send a message in the group chat. Obviously, there are things to improve. For example, the recipe fires every time I’m around the location, even if I’m there for a walk. It would be great to activate the recipe only for a particular time interval, but IFTTT doesn’t offer this option. But the recipe could be manually disabled.

Following the same method, there are plenty of stuff the bot can write in the chat, using the many IFTTT channels. Fantasy is the limit :)

Reddit as source for a COPE strategy, and IFTTT for all the rest

IFTTT Reddit to SlackAfter the first CLSxItaly, we added to the Slack a new channel to share interesting community management resources, like blogposts etc. It was good, because allowed us to continue the discussion with interesting ideas, mainly thanks to the tireless work of Alessio.

But I felt we were missing something, like a broader sense of sharing with other community managers outside the Slack, that could be interested to same links too. Or an easy way to browse and search thru the different resources posted. Or a way to maintain the discussion visually connected with the different links posted, instead of a long stream of messages.

I remembered that, in the old days, a dedicated service was created for link sharing and discussion, a service that has survived to the present days: Reddit. Don’t know about it? You should! Reddit looked to me the perfect place to post our resources, and turns out that a subreddit dedicated to community management already exists: r/CommunityManager.

Great! But neither I could ask to all the CLSxItaly member to migrate from Slack to Reddit, nor force a double post on Slack and Reddit. Thankfully, IFTTT came again in handy, with channels for Reddit and Slack, plus others, so I was able to quickly implement a C.O.P.E. (Create Once, Publish Everywhere) strategy, using Reddit as source and then publishing the same content on the Slack content-sharing channel, Twitter and, potentially, many more. It also satisfy different kind of users with different kind of social feeds or tools habits (I, for example, still prefer RSS feeds aggregated by a reader).

I created a new IFTTT recipe using Reddit channel for the “this” part and selecting the “Any new post in subreddit” trigger, using “CommunityManager” as parameter.

IFTTT Reddit channel

For the “then” part, instead, I used the Slack channel with the “Post to channel” action.

IFTTT Slack channel

Too easy. Now, every time someone post a link in the r/CommunityManager, the Slack channel get a message (with a delay of some minutes). Is not that cool and complete as posting a link on Slack (with image, content snippet etc), but it works well.

Finally, I did another recipe to post the same link on Twitter, to be really COPE ;)

Extending the GDG Community Summit with CLSx steroids

CLSxItaly communitiesSummer is coming, so it’s time to plan a new round of national community summits for Google Developer Group communities before enjoying a long series of mojitos on the beach. Given the main objective of these summits, offer a dedicated learning/sharing moment on community management topics to the GDGs, this year we (my team and I) come up with the idea to use the summit to extend this moment to all the tech communities in the ecosystem. And because we’re already familiar with CLSx events, we decided to organise a CLSx as activity for the first day of the summit, and leave the second day focused on GDGs only, as it has always been.

Why? Because GDGs are still at the center of our hearth, but we think we can do more for the entire community scene, so an open event for everyone interested in community management topics.

Because we’ve seen that the true potential of the ecosystem can be unleashed if the communities collaborate each other: sharing speakers, best practices and other resources, mutually empowering, drafting a common mindset for the city / area. And all these process can start only if the different community leads in the same area know each other. Clearly, this is not true for all the cities in the same way, but it’s a good starting point.

Finally, because we would also add our contribution to tackle the gender diversity issue in tech ecosystem, and working only with a set of tech communities doesn’t allow to have holistic approach this kind of issue requires.

Where? In the countries we support where the GDG communities are already thinking at country level instead of a single chapter level, so used to learn by sharing and ready to mix with a new crowds without losing their own identities. We’ve selected Italy (Rome), Spain (Madrid) and France (Paris), among the countries we support. We’re instead going for a “traditional” community summit in the other countries (Netherlands, Nordics, Greece).

Stay tuned :)

How to setup a Google App Engine Python environment, on Mac OSX, using Homebrew

20160402-logo_bannerI want to create Google App Engine apps using Python SDK on my OSX machine: setting up the enviroment should be easy, but I neverthless spent some time putting together all the required pieces. The whole process is composed by four parts: install Homebrew, install Python 2.7 thru brew, install Google App Engine Python SDK and setting up the project environment. Let’s go step by step.


Simple and straightforward, instructions on Homebrew homepageXcode Command Line Tools is the only prerequisite.
Personally, I’ve used a different install folder (a different prefix) instead of /usr/local, but it’s just me and some bottles could not work. So the suggestion is to stay with the default prefix. Here the step I used:

xcode-select --install
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install > ~/brew.rb
sed -i '' 's/HOMEBREW_PREFIX = .*/HOMEBREW_PREFIX = "#{Dir.home}\/tools/homebrew"/' ~/brew.rb
ruby ~/brew.rb

Then I added the Homebrew custom prefix to my PATH adding the following line at the end of ~/.bash_profile


To check that everything works, a call to brew doctor should return just a warning about the custom prefix.


Once Homebrew is in place, install Python is a breeze:

brew install python

Then, I installed the additional tools required to properly work, pip (already installed with Python 2.7, but it may need an update) and virtualenv

pip install -U pip
pip install virtualenv

Google Cloud SDK + App Engine Python

Even if the site suggest to download GoogleAppEngine Launcher, I chose to use Google Cloud SDK, in order to have one single point of access for all the Google Cloud related stuff, instead that different runtimes scattered around my machine:

curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init

The init command also update ~/.bash_profile, adding auto completion and updating the PATH for the Google Cloud SDK. These two lines

source ~/tools/google-cloud-sdk/path.bash.inc
source ~/tools/google-cloud-sdk/completion.bash.inc

Finally, I added the GAE Python SDK with

gcloud components install app-engine-python

Setup the first GAE project

Time to create the first GAE Python project. Luckily, official documentation has everything to start and succeed, and the section “Download the App Engine SDK for Python” can be skipped because of the Google Cloud SDK already installed.
Real problems arrive when additional Python library are required, like Flask. Following the official steps suggested here has one big problem: when executing the command pip install -t lib, the following error occurs:

DistutilsOptionError: must supply either home or prefix/exec-prefix — not both

It’s a well known bug of Python installed with Homebrew, and the workaround proposed didn’t worked for me. After some searching, I was able to solve the problem using a properly setup virtualenv environment and a symlink. Inside the project folder:

virtualenv env
source env/bin/activate
ln -s env/lib/python2.7/site-packages lib

Then, it’s important to skip the upload of virtualenv environment files, adding the following lines to the app.yaml file. GAE will continue to upload all the required libraries from the lib folder (a symlink to the lib folder inside the virtualenv), so no need of the entire env folder:

- ^env$ #virtual environment's folder

Finally, it’s possible to create the appengine_config.py to enable vendoring and inclusion of libraries in the lib folder, as per the official doc.

from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.

Ahh, time to install some lib, edit files, launch the GAE dev server and start coding!

pip install flask
#(add and edit your files)
dev_appserver.py .

How to effectively get feedback on a talk

20160319-talkWhen I do public speaking, my talk doesn’t finish after the last question from the audience, it finishes once I’ve analysed the feedback attendees have provided. Feedback, for me, are a cornerstone of a talk life cycle (together with prepare, rehearsal and present). Let’s see different techniques I use to gather them, achieving more than 60% response rate.

Decide for meaningful and quick to fill feedback

My goal while asking for feedback is to know what I can improve for the next time: what is done is done, unfortunately. People are lazy by nature, so it’s important to find the right balance between time requested to provide feedback and detail of the information obtained. The less time, the better. Just an empty field with a question like “What do think about the talk” won’t work, it’s too generic and people will need time to think about it and what they input could be useless for me. On the other side, only a simple scale to grade the talk is too simple. Here the questions I generally ask:

  1. “How useful was the talk for you?”, a mandatory scale from 1 to 5 where 1 is “Time wasted” and 5 is “Very useful”
  2. “What you liked the most?”, a multiline free text form
  3. “One think to improve for the next time”, a multiline free text form

Make easy to provide feedback

Once I have the questions, next step is to ask them to the attendees in the quickest and painless possible way. Sites with a login is a no-go. Anonymous Google Form is perfect: credentials are not required, light to load, fits on mobile screens, focused on the task of input info, pre-fillable data via a customised URL. Try by yourself :)

20160319-slideThen the audience need the form link, so a add a slide like that at the end of my deck: the biggest QR-Code possible with form URL, plus the short address to the same form in case QR-Code doesn’t work (app not installed / low light / too small for people from the last rows etc). To be more creative, I can also use an Eddystore-URL beacon to transmit the URL, but software support to read it is, nowadays, far more complex than a QR-Code scanner. But it’s cool :)

Everything is in place, finally. But if you ask to give you feedback, only few attendees will do. Why? Because people are lazy, as said previously :)

Add some fun to the feedback experience

There are two main techniques I tested over time. First one is about explicitly ask participants to give you feedback, and declare the next 90 seconds will be dedicated to that, before start taking questions. Drawback is… the 90 seconds of silent after the request! People will be busy filling the questions, but 90 seconds of silent are tough to manage and can ruin the atmosphere of the talk.

20160319-wheel_of_namesAnother option comes from my colleague Martin Omander, that created thisWheel of Names” to distribute one gadget to the lucky winner of the raffle. I anticipate to the attendees that the ones that fill the feedback form will participated to a raffle for a small gadget. They only need to add a name or nickname at the end of the form to be eligible. Nicknames are important so people can stay anonymous in their feedback.
After the before mentioned 90 seconds, I open the form responses, copy the column with people’s nicknames in the space right to the wheel and spin it. Drawback is I need to have a gadget to offer, but sometimes can even be a symbolic object I donate to the winner, without a real value, just for fun. And it works, I can assure.

CLSxItaly: what happened and lessons learned

Communities corner

A corner with all the communities visually represented

Are you interested in what happened during the first CLSxItaly? Take a look to the Storify and to the recorded morning sessions. Curious about my retrospective? Please keep reading.

I’m excited

I’m excited because I get excited when one of my idea come to life and influence real people, in real life, and has an impact. So was CLSxItaly: from a thought I had in July to an occasion where 65 people met and shared around one the their passions: community management! First time for Italy, as far as I know, first time, for sure, for technical communities.
I’m excited because only half of the attendees came from technical communities, while the other half represented travel communities, open source projects, coworking and urban spaces, creative artists, maker and much more.
I’m excited because we has a 35% women participation, and diversity matters.
I’m excited because we all had fun: 3,74 average score (out of 4) is something we can be proud of ! :)

Key learnings

The CLSxItaly core organisers

The CLSxItaly core organisers

First personal gain was the core organisers team: discover that a spontaneous group of people is able to create a team that works great for accomplishing a particular tasks is always a bless! And so were Alessio, Michel and Stefano. Thank you guys, you make my small dream possible, and with style!

Second important point was the umpteenth confirmation that a vision, passions and personal relationships are the three key tools to achieve any goal: the before mentioned organisers team gifted me with their own time and commitment; Davide had no hesitation when I asked him “We need a place to host 100 people for an event, and for free”; Francesco, Francesco and Mara+Chiara+Andrea put real money to make everything possible: they all believed in the same vision I had and, sustained by a common passion and connected by our personal relationships, we all morphed that vision into a real fact.

Me rearranging unconference proposals

Me rearranging unconference proposals

Third key actor for the success of CLSxItaly were the attendees. Every time I received an Eventbrite notification that someone paid 15 euro to join, I though “Oh wow, another person that trusts in our idea”. The most important positive feedback we received were about the quality of the networking, the easy-going atmosphere and the constant sharing. All of them were only because of the quality of the attendees. Probably the non-free ticket for the event, the (still) niche topics discussed and the location helped to pre-selected the audience.

Regarding the experience to offer to the attendees, selecting only two core goals and working all around them made the job. We choose to focus in creating a learning path equally composed by frontal teaching along a common narrative (the plenary sessions during the morning) and peer learning (the unconference in the afternoon), plus special care in creating lot of occasions to get in touch each other and warm-up relations as soon as possible. All the rest followed: over the two coffee breaks, the lunch and the aperitif I saw lot of different aggregation groups, and this was positive. Despite just a bounce of folks have participated to an unconference before CLSxItaly, the general feeling was positive.

So, what’s next

I lead an unconference session regarding next steps for CLSxItaly. We had some ideas to run the next event in Rome in six months, drive by people of the local context. Let’s see. For sure, I want continue what has been started in Milan. But, as for Milan, I cannot do it alone. Wanna help? Join the discussion!


Millenials, Digital Native and Mobile Native


Photo credit: Optician Training

I often hear about these terms, mostly in demographic discussion around marketing segments. So I’m writing down some notes gathered around to clarity the (fragmented) boundaries of each group.

Millennials: born from 1980-1995, nowadays 21 to 36 years old. They prefer access (Zipcar, Airbnb) over ownership, have childhood experiences with technology and they saw a rapid increase in personal Internet usage.

Digital Natives/Generation Z: born from 1996-2008, nowadays 8 to 20 years old. They raised in a digital, media-saturated world, have attention spans of 8 seconds, spend 10+ hours of time online daily, majority on their smartphones. They prefer multi-tasking and like being on 5+ screens at once.

Mobile Natives: born from 2009-Present, nowadays up to 9 years old. 7% of babies under the age of one have used a smartphone. Nearly ⅓ of babies under the age of 2 can navigate mobile phone without help. By age 4 over 35% of toddlers use a smartphone for an hour a day.

Nice to know that, even if one age-generation separates me and my son, it seems there is a 4 consumer-generations gap between each other. Oh yes, I’m a Generation Y, not even a Millenials ;)