Mixpanel analytics middleware for the Telegraf Telegram bot framework. Current version 1.0.0. Provides a simple way to track events, set people properties, and manage charges directly from Telegraf context via `ctx.mixpanel`. Requires Telegraf v2 or v3. Lightweight wrapper around the Mixpanel Node.js library, designed for bot-specific analytics workflows like sales funnels. No breaking changes yet; limited to single Mixpanel instance per bot.
npm install telegraf-mixpanelVerified import paths — ran on the pinned version, not inferred.
Initializes Telegraf bot, attaches Mixpanel middleware, and tracks a 'start' event and people property on /start.
Ensure mixpanel usage is inside middleware chain where ctx has been processed.
Install mixpanel: `npm install mixpanel`.
For Telegraf v4+, do not use this package; consider updating to a maintained fork.
Correct usage: `const TelegrafMixpanel = require('telegraf-mixpanel'); const m = new TelegrafMixpanel(token);`Ensure Mixpanel token is valid and handle errors with try/catch.
Run `npm install mixpanel`.
Use `const TelegrafMixpanel = require('telegraf-mixpanel');` (not destructured).Call `bot.use(mixpanel.middleware())` before using the bot.