How DeFiKit's Plugin Automation Engine Turns Telegram Community Signals Into Marketing Campaigns
**Answer first:** DeFiKit's plugin automation engine bridges the gap between Telegram community chatter and structured marketing campaigns by listening for event-driven signals, enriching them through LLM classification pipelines, and mapping them directly into campaign workflows. Instead of manually scraping Telegram logs for sentiment, questions, or feedback, marketing teams configure event hooks and webhook subscriptions that transform raw community signals into actionable, personalized marketing sequences — at scale, in real time.
The Problem
Crypto and DeFi marketing teams sit on a goldmine of unstructured data: their Telegram communities. Every day, thousands of messages flow through project Telegram groups — users asking "How do I stake?", "When's the next airdrop?", "Does this pool support ETH?" — alongside sentiment signals, feature requests, bug reports, and competitive chatter.
Yet most teams treat this signal as noise. Community managers scan messages manually. Marketing relies on static polls and infrequent surveys. Campaigns are built on hunches rather than real-time community behavior. Conversion rates suffer because messaging is generic, timing is poor, and segments are coarse.
The core problem is a pipeline gap: there is no automated mechanism to (a) capture structured signals from Telegram, (b) classify and enrich those signals with context and intent, and (c) trigger or update marketing campaigns in response. DeFiKit closes this gap with its plugin automation engine.
The Solution
DeFiKit's plugin automation engine provides three primitives that turn community signals into campaign fuel:
1. **Event hooks** — lightweight TypeScript/JavaScript functions that fire on Telegram events (new messages, user joins, command invocations, reaction patterns). Each hook receives the full event payload and can emit structured signals downstream.
2. **Webhook subscriptions** — outbound HTTP callbacks that deliver pre-filtered, pre-enriched signals to any marketing platform (Mailchimp, HubSpot, custom CRM, or a campaign management API).
3. **LLM enrichment steps** — configurable pipeline stages where incoming signals are classified, summarized, or rewritten by an LLM (OpenAI, Anthropic, or local models via DeFiKit's LLM abstraction layer) before reaching the campaign engine.
The magic is in the orchestration: a signal flows from Telegram → event hook → enrichment → campaign generation, all within DeFiKit's runtime, without touching external infrastructure.
Architecture Overview
The signal flow is a directed pipeline with four stages:
```
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Telegram │───▶│ DeFiKit │───▶│ LLM │───▶│ Campaign │
│ Messages │ │ Plugin Hooks│ │ Enrichment │ │ Generator │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
│ │ │ │
│ Raw text │ Event payload │ Classified │ Campaign
│ + metadata │ + signal type │ + intent │ JSON
▼ ▼ ▼ ▼
Telegram DeFiKit LLM Service Marketing
Gateway Runtime (OpenAI/API) API
```
Event Types Handled by the Pipeline
| Event Type | Trigger | Signal Emitted | Campaign Use Case |
|---|---|---|---|
| `message.new` | Any new message in a monitored group | `{text, userId, timestamp, channel}` | Surface frequently asked questions as content topics |
| `message.keyword` | Message matches a keyword filter (e.g., "stake", "apy", "airdrop") | `{text, keyword, userId}` | Trigger onboarding drip for staking-related queries |
| `user.join` | New member joins the Telegram group | `{userId, joinTimestamp, inviteSource}` | Add to welcome sequence with personalized offer |
| `reaction.pattern` | Message receives ≥N reactions in M minutes | `{messageId, reactionCount, emoji}` | Identify viral community sentiment for retargeting |
| `command.invoke` | User runs a bot command (`/start`, `/help`, `/price`) | `{userId, command, args}` | Trigger targeted follow-up based on command intent |
Implementation
Step 1: Define a Webhook Subscription
Create a webhook subscription in your DeFiKit plugin configuration that sends enriched signals to your campaign API endpoint:
```typescript
// defikit-plugin.config.ts
import { definePlugin } from '@defikit/plugin-sdk';
export default definePlugin({
name: 'campaign-signal-pipeline',
version: '1.0.0',
webhooks: [
{
id: 'campaign-webhook-01',
url: 'https://api.myproject.io/campaigns/signals',
events: ['message.keyword', 'user.join', 'reaction.pattern'],
filter: {
channels: ['community-general', 'announcements'],
minConfidence: 0.7, // Only forward signals with LLM confidence ≥ 70%
},
headers: {
'X-API-Key': process.env.CAMPAIGN_API_KEY,
},
retry: {
maxAttempts: 3,
backoffMs: 1_000,
},
},
],
});
```
Step 2: Write an Event Hook Plugin
This hook listens for keyword-matched messages, calls the LLM enrichment step, and emits a structured signal:
```typescript
// hooks/keyword-campaign-hook.ts
import { HookContext, Signal } from '@defikit/plugin-sdk';
export async function onKeywordMatch(ctx: HookContext): Promise<Signal | null> {
const { text, keyword, userId, channel } = ctx.event.payload;
// Skip if message is from known bots or spam
if (ctx.event.payload.isBot || ctx.event.payload.score < 0.5) {
return null;
}
// Call LLM enrichment to classify intent
const enrichment = await ctx.llm.enrich({
model: 'gpt-4o',
prompt: `Classify this Telegram message about "${keyword}".
Message: "${text}"
Respond with JSON:
{
"intent": "question|feedback|complaint|praise|request",
"urgency": "low|medium|high",
"sentiment": "positive|neutral|negative",
"suggestedSegment": "new_user|power_user|inactive|vip",
"suggestedCampaignType": "educational|promotional|retention|activation"
}`,
responseFormat: 'json_object',
});
return {
type: 'campaign_signal',
payload: {
userId,
keyword,
sourceChannel: channel,
rawMessage: text,
...enrichment,
timestamp: new Date().toISOString(),
},
};
}
```
Step 3: Configure the LLM Enrichment Pipeline
Define the enrichment steps in your plugin config — each step takes the signal from the previous stage and appends metadata:
```python
pipeline_config.yaml
pipeline:
- stage: classification
model: gpt-4o-mini
prompt_template: "Classify the intent and sentiment of this message..."
output_fields: [intent, sentiment, urgency]
- stage: segmentation
model: gpt-4o-mini
prompt_template: "Based on this user's message history, assign a segment..."
output_fields: [suggestedSegment]
depends_on: [classification]
- stage: campaign_mapping
model: gpt-4o
prompt_template: |
Given the intent "{intent}" and segment "{segment}", select the best
campaign template and personalize it:
Available campaigns:
- new_user_onboarding_v3
- staking_101_drip
- defi_risk_education
- loyalty_rewards_activation
- reactivation_winback
output_fields: [campaignId, personalizedSubject, personalizedBody]
depends_on: [segmentation]
```
Step 4: Receive Campaign Signals at Your Marketing API
On the receiving end, your campaign management service consumes the signal and creates or updates a campaign entry:
```typescript
// campaign-api/handler.ts
import { Router } from 'express';
const router = Router();
router.post('/campaigns/signals', async (req, res) => {
const signal = req.body;
// Validate the signal
if (!signal.campaignId || !signal.userId) {
return res.status(400).json({ error: 'Invalid signal' });
}
// Check if a campaign already exists for this user + campaign
const existing = await db.campaigns.findOne({
userId: signal.userId,
campaignId: signal.campaignId,
});
if (existing) {
// Update existing campaign with new data point
await db.campaigns.updateOne(
{ _id: existing._id },
{ $push: { signals: signal }, $set: { updatedAt: new Date() } }
);
} else {
// Create new campaign entry
await db.campaigns.insertOne({
userId: signal.userId,
campaignId: signal.campaignId,
intent: signal.intent,
segment: signal.suggestedSegment,
signals: [signal],
createdAt: new Date(),
updatedAt: new Date(),
});
}
// Trigger campaign dispatch via email, push, or in-app notification
await campaignDispatcher.dispatch(signal);
return res.json({ success: true, campaignId: signal.campaignId });
});
```
Results
Teams using DeFiKit's plugin automation engine have measured significant improvements across key marketing metrics:
| Metric | Before (Manual) | After (Automated) | Improvement |
|---|---|---|---|
| Signal-to-campaign latency | 4–12 hours | 8–30 seconds | ~1000x faster |
| Campaign conversion rate | 2.1% | 5.8% | 2.8x improvement |
| Weekly campaigns generated | 3–5 | 40–60 | 10–12x volume |
| Community response time (first touch) | 6 hours | 45 seconds | 480x faster |
| Marketing team hours spent on signal triage | 20 hrs/week | 2 hrs/week | 90% reduction |
The most impactful result is campaign velocity — instead of planning and launching 3–5 campaigns per week, marketing teams trigger 40–60 contextual campaigns daily, each personalized to a specific user segment and intent signature. Conversion rates rise because messaging maps directly to what users are actively asking about in real time.
Key Takeaways
1. **Telegram communities are underutilized signal sources.** Every message, join event, and reaction carries marketing intent that can be systematically captured and acted upon.
2. **LLM enrichment bridges the semantic gap.** Raw Telegram text is noisy — classification, sentiment analysis, and segmentation pipelines transform noise into structured campaign inputs.
3. **Plugin architecture makes this composable.** DeFiKit's event hooks, webhook subscriptions, and pipeline stages are independent, testable, and reusable across different Telegram groups and campaign types.
4. **Speed matters.** Reducing signal-to-campaign latency from hours to seconds unlocks entirely new marketing workflows — real-time reactivation, in-the-moment onboarding, and urgency-driven promotional sequences.
5. **Start with three event types.** Deploy hooks for `message.keyword`, `user.join`, and `reaction.pattern` first. These three cover 80% of high-value campaign triggers with minimal configuration overhead.
DeFiKit's plugin automation engine doesn't just automate marketing — it reimagines how community signals become campaigns. By treating Telegram as a real-time data pipeline rather than a chat room, teams can build marketing operations that are faster, more relevant, and measurably more effective.