How to research community members behaviors in your Telegram group for free using Amplitude

Igor Martynov
6 min readNov 6, 2020

--

In this article I’ll show you how to employ Amplitude product intelligence to get valuable insights about your community for free.

Amplitude Pipedream Telegram Node.js Integration API — one wave
Originated from “The Wave” by Hokusai

OK, let’s imagine that you, like me, already have a community in your public (or private) Telegram group. At this point, all you know about your group and its members is the total users count. How to research it? How to know your community better?

Think about your group as a product. You need data. And it’s also substantial to own your data.

The solution: own a Telegram bot that transfers essential data from your Telegram group to Amplitude with Pipedream workflow written in Node.js.

A solution flowchart

Ingredients

  1. Telegram bot, completely free. Telegram is an instant messaging platform, having 400 million monthly active users in April 2020.
  2. Amplitude, free account up to 10K group users. Amplitude is an analytical platform for 40,000+ digital products.
  3. Pipedream, free account. Pipedream is a low-code tool that helps 50,000+ developers to integrate any API in a fast and professional manner.

Telegram bot

Telegram is a super fast-growing platform for instant messaging; however, it is a black box at the statistics level. Managing a large group is a mess. But, with help from Telegram Bot API, you can create simple but effective tools to work with your groups.

Step 1. Create new Telegram bot. Save the token.

Name it as you like. Let me omit the details to be clear and concise. The outcome — is the token.

Step 1. Create new Telegram bot. Dialogue with BotFather

Step 2. Add bot to your group.

In your group, click “Add members” and choose bot from list. Now your bot, as any user in the group, will be informed on every event fired in a group.

Amplitude

Amplitude is an analytical platform for digital products that helps them to grow by understanding its users, improve their experiences, and increase retention. You can arrange a realtime dashboard with the most important charts and obtain a new look at your group.

As a first-class analysis tool, Amplitude is a bit complicated, so we will only cover the basics here. All you need is a free account and an empty project.

Step 3. Create an Amplitude project. Save the API key.

  1. Sign up and create a free account, then you will be navigated to demo.
  2. Verify your email and click “Set up on the Free Plan” button on the top.
  3. Fill “Create New Organization” form, skip the intro, etc.
  4. Click “Create Project” button.
  5. Save the “API Key”.
Step 3. Save the API Key

Simple so far, but..

Pipedream

Now, the magic part. In the early days, you had to be a software developer to commit the next steps, which meant a lot of time, resources, and knowledge. Now, with low-code tools as Pipedream, there is no need to hire a programmer and rent a server. Build and deploy your programs on the fly, oh, sorry, don’t think about building and deploying. Just own your empire of scripts and bots for free with a few Node.js lines.

So, we need a workflow (a simple script) triggered by HTTP requests. I’ve prepared a public workflow which you can copy and customize.

Step 4. Create your endpoint and workflow.

  1. Sign in with Google or GitHub.
  2. Open my public workflow: http://bit.ly/telegram-to-amplitude.
  3. Click “Copy” on the top right corner.
  4. Paste your Amplitude “API Key” into the corresponded field (marked with red border).
  5. Create your endpoint by clicking the “Create source” button.
  6. Enable the trigger by clicking the black switch button on the top right.
  7. Copy your unique endpoint URL address, it will look like “https://RANDOMADDR.m.pipedream.net” and save it.
Step 4. Create your endpoin and workflow

That’s it! Only you knows the endpoint URL, so please don’t share it.

Step 5. Route all events from Telegram to that source.

That’s the trickiest part. Telegram didn’t have an interface for that, and you should combine the address and open manually. Use plain text editor for that. Here is the instructions.

For example, your <token> is “YOURTOKEN” and <URL> is “https://RANDOMADDR.m.pipedream.net/”, the combined string will be:

https://api.telegram.org/botYOURTOKEN/setWebhook?url=https://RANDOMADDR.m.pipedream.net/

Open it once in private mode of your browser. Here is the details on making requests and setting a webhook.

Finally, in Amplitude

In this tutorial I’m covering the basics, and you will receive events in Amplitude for two main events in your group:

  • “Chat message”, when someone post a message,
  • “New member”, when new user joins the chat.

In addition, Amplitude will generate “New user” event, a generic event indicating that new user started to interact with your group.

Step 7. Check the “User look-up” page.

Post anything onto your Telegram group. After a short period, you should see it:

  1. in the “Live events” list at your workflow on Pipedream.
  2. in the “User look-up” page of your project on Amplitude.

Step 8. Craft reports for your product.

You are ready to create your charts. For example, here is m: uniques for the last 6 weeks in an event segmentation chart and a lifecycle graph. As you can see, active existing users passed into the “New user” category for the start.

Event segmentation chart and weekly lifecycle graph

And here is the retention chart for the last 30 days.

Retention chart

Conclusion

It needs time to run, but it worth it. And you will not get the fast result, as it only takes new events. But from now — you are the owner of your private data source.

Next steps?

If you are a product manager or a data analyst like me, there’s plenty of space for your imagination. Feel free to suggest your use-cases here in the comments or get in touch via Telegram or Twitter.

  • Track the impact of campaigns. Make a poll or cover a hot topic with a request for comments. Compare the results of the different activities.
  • Refine events detecting. Detect the first message for a new user, question marks, or hashtags in posts. Add conversion events.
  • Group itself is a strict tool for the community; therefore, I’ve made a no-code web app with profiles, events, and ratings, which is accessible only for the group members.

Notes

Due to the limitations of the protocol, it’s unable to receive the“user left” event in “supergroups”.

Credits

Thanks to Antony Castrio for influencing and helping with the text :)

--

--

Igor Martynov
Igor Martynov

Written by Igor Martynov

Product Manager, Data Analyst, No-Code maker, and an Indie Hacker. I create my life. https://igormartynov.com/

No responses yet