Thoughts on a Community Management Chatbot

Chatbot hype is over and their forecasted disruptive impact has been tremendously reduced. Nevertheless, I still see some good scenarios where a Community Management Chatbot can help in offline community management thanks to its conversational interface.

One side, it can support community leaders offering “wisdom” about the community management art. Part of my daily job as community builder is to connect with community leaders, asking what’s happening in their groups and I’ve noticed there are similar discussions going over and over. How to start an offline community, best practices to organize its first event, how to find new speakers, venue and sponsors, how to organize more inclusive events etc. A community management chatbot can offer insights on them when triggered. It’s far more scalable than me, available 24/7 and I can dedicate time saved to more specific and in-deep requests.

On the other side, the chatbot can help community builders providing alerts, suggestions and action items for their daily job. Sending alerts on communities that have not been doing event for lot of time, upcoming events requiring attention, the next communities to get in touch with, retrieve reports, show internal community success metrics, etc. In addition, these conversations can happen in a ChatOps scenario, to create a Community Management ChatOps workflow with my colleagues!

To summarize, and looking from two angles, the community management chatbot targets and the level of knowledge it has about their communities, we could have this potential features quadrant:

Community Management Chatbot Feature quadrant

Let’s see some concrete examples for community leaders target.

Community Management chatbot for community leaders, with no community knowledge

There are two learning paradigms: a pre-Internet-and-search-engines: read, memorize and hope, when you need that information, you’ll remember it or where to look for it. Then, the post-Internet-and-search-engines: you search what you need when you need it, without too much previous knowledge on the topic.
The majority of community leaders I know haven’t studied the art of community management, so they use the second approach trying to solve their community needs. Unfortunately, search engines return results too generalist or inappropriate for lot of those “basic” questions. The community manager chatbot could be used as a sort of improved search engine.

Any person can ask, for example, “how to organize my first community event?” or “how can I search for speakers?”, or “what can I do to increase retention rate of my community?” and so on. Ideally, the bot should give at least one actionable item for every reply to keep the human side engaged, asking also for more information to contextualize the request and offer more refined answers. Follow a potential conversation script:

User: “Hi, I need to organize an event”
Community Management Chatbot: “Great, it’s the best way to keep your community active and well perceived in the local context. Do you already have a venue?
User: Yes
CMG: Perfect, so you need content to present. Is the agenda defined, or someone presenting something?
User: No. How can I find a speaker?
CMG: I would suggest to first look around you. If your community is not new, you may ask their members if they wanna present something. Or you can find speakers talking at similar events, reach them and ask to talk at your event. How old your community is?
User: it’s brand new, it’s my first event.
CMG:  I see. You may look for speakers in conferences with the same focus of your community and happened in your country. Once you have that list, you can try to reach them proposing to come and speak at your first meetup. You never know how much people are happy to help a new community, especially local speakers!
User: I’ll do, thanks.
CMG: See you soon!

The bot is open to everyone and doesn’t need to remember conversations or user details. It comes to my mind a model similar to a text adventure, where the player (the community leader) explores a dungeon (the first question) gaining items (the replies to their question) while choosing where to go (the follow-up questions the bot makes to better contextualize).

To make things simpler, initially such bot can help only on a specific set of questions and, over time, it can learn more and more about the art of community management, broadening its expertise and the support able to offer.

In term of technology, I’m already doing some tests using DialogFlow to understand what user says, a Google Doc with the conversation script, so it’s easily editable and with no tech knowledge, and a Python backend to match user intents detected by DialogFlow with script sections in the doc. Still in a too early stage to share, but If you’re interested in helping, ping me!

Community Management chatbot for community leaders, with community knowledge

If the bot knows data about the community led by the person interacting with it, it could be more proactive and focused. Data could be retrieved connecting the bot with the community account on Meetup.com, or Facebookm or other sources. Here an examples of a data-aware interaction:

User: Hello!
Community Management Chatbot: Welcome back Alfredo! I see yesterday event was a success, with more attendees that the average: well done! Have you already sent the follow-up email?
User: Mmmm, not yet.
CMG: Please do it, the sooner the better, especially if you want to have reliable feedback from the attendees. Here a simple template you can use (link)
User: Thanks. Anything else?
CMG: A couple of things. It seems you’re alone in leading the community, is that right?
User: Yes, I’m the only one now.
CMG: So, at this point and after the events you’ve made, I would give high priority to find a co-organizer. It seems an hard task, but the benefits are enormous. Have you noticed if someone has come over and over to your meetups?
User: Yes, there are two people who I see often at my events.
CMG: It’s a start! What about asking them to give you a hand for the next event? They could find a venue or a speaker, taking care of the catering, post on social media about the event and much more. Small tasks, but if they help you and keep helping, they could be open to run the community with you.
User: Any other way?
CMG: Of course! You can also …

In this scenario, the bot is able to offer more focused suggestions and proactively ask questions to the community leader, based on the data it has and on community best practices applied to that data.

I have still no idea on how to make such bot, but narrowing the scope to a particular kind of community (Google Developer GroupTwitter Developer Community, etc) can help a lot in the data collection tasks, and the bot can connect a user to their community with a simple question during the first interaction. It would be great if Meetup.com can offer this service, for every community it hosts (or with a Pro account).

I’ll talk about the higher quadrants, chatbot for community builders, in a follow-up post. Any thoughts so far?

 

More Telegram bot features using IFTTT

Telegram bot with IFTTT recipesNow that I created a Telegram bot fed by IFTTT, I can add new features using the available channels. A message with the Milan weather condition every morning, for example, or a cool 500px picture during the day to take a break and enjoy the beauty? Possibilities are limited only by IFTTT skills.

The logic is easy: every recipe has a different trigger (the “this” past), and the action is always the same: use the Maker channel to send a POST HTTP call to the Telegram bot, formatting the message with the specific information I want to display. To create the Telegram bot, please look to my previous post.

Weather

Telegram bot weather

The trigger to activate in the Weather channel is “Today’s weather report”, setting the time of the day the report has to be sent. I set 7.00 am because I prepare last minute, but it’s also possible to select “Tomorrow’s weather report” and receive the message the evening for the ones that want to plan what to dress the next day in advance. There are plenty of other information available in the triggers, like sunrise and sunset time, change of conditions / temperature and much more. The city is selected when the channel in connected with the IFTTT account.

The action is the “Make a web request” is the Maker channel, using the following parameters (XXtokenXX and the chat_id have to be changed with the appropriate values):

  • URL: https://api.telegram.org/botXXtokenXX/sendMessage
  • Method: POST
  • Content type: application/json
  • Body: {“chat_id”:”-235327410″, “text”:”Good morning. In Milan {{TodaysCondition}}, max {{HighTempCelsius}} min {{LowTempCelsius}}”}

Cool 500px pictures

Telegram bot with picture

The trigger to activate in the 500px channel is “New Editors’ Choice photo”, selecting one of the available categories, or any.

The action is the “Make a web request” is the Maker channel, using the following parameters:

  • URL: https://api.telegram.org/botXXtokenXX/sendMessage
  • Method: POST
  • Content type: application/json
  • Body: {“chat_id”:”-235327410″, “text”:”Breath and enjoy the beauty: [<<<{{Title}}>>>]({{SourceUrl}})”, “parse_mode”:”markdown”, “disable_web_page_preview”: “false”}

In order to have a preview of the image embedded in the bot message, I used parse_mode set to markdown and i set disable_web_page_preview to false, even if it’s the default setting. Of course the text value is written using Markdown syntax. For more information on the available parameters, the official doc is a good reference. Again, XXtokenXX and the chat_id have to be changed with the appropriate values.

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.

20160804-createbot

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:

{"ok":true,"result":[]}

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:

{  
  "ok":true,
  "result":[  
    {  
      "update_id":43841716,
      "message":{  
        "message_id":122,
        "from":{  
          "id":000000000,
          "first_name":"Alfredo",
          "username":"rainbowbreeze"
        },
        "chat":{  
          "id":-235327410,
          "title":"YellowFamily chat",
          "type":"group"
        },
        ....
}

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

{  
  "ok":true,
  "result":{  
    "message_id":177,
    "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 :)