@framers/agentos-ext-telegram 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +317 -0
  3. package/dist/index.d.ts +80 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +227 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/services/telegramBot.d.ts +167 -0
  8. package/dist/services/telegramBot.d.ts.map +1 -0
  9. package/dist/services/telegramBot.js +302 -0
  10. package/dist/services/telegramBot.js.map +1 -0
  11. package/dist/tools/getChatInfo.d.ts +77 -0
  12. package/dist/tools/getChatInfo.d.ts.map +1 -0
  13. package/dist/tools/getChatInfo.js +119 -0
  14. package/dist/tools/getChatInfo.js.map +1 -0
  15. package/dist/tools/handleCallback.d.ts +55 -0
  16. package/dist/tools/handleCallback.d.ts.map +1 -0
  17. package/dist/tools/handleCallback.js +78 -0
  18. package/dist/tools/handleCallback.js.map +1 -0
  19. package/dist/tools/manageGroup.d.ts +54 -0
  20. package/dist/tools/manageGroup.d.ts.map +1 -0
  21. package/dist/tools/manageGroup.js +105 -0
  22. package/dist/tools/manageGroup.js.map +1 -0
  23. package/dist/tools/sendDocument.d.ts +59 -0
  24. package/dist/tools/sendDocument.d.ts.map +1 -0
  25. package/dist/tools/sendDocument.js +86 -0
  26. package/dist/tools/sendDocument.js.map +1 -0
  27. package/dist/tools/sendMessage.d.ts +94 -0
  28. package/dist/tools/sendMessage.d.ts.map +1 -0
  29. package/dist/tools/sendMessage.js +142 -0
  30. package/dist/tools/sendMessage.js.map +1 -0
  31. package/dist/tools/sendPhoto.d.ts +54 -0
  32. package/dist/tools/sendPhoto.d.ts.map +1 -0
  33. package/dist/tools/sendPhoto.js +80 -0
  34. package/dist/tools/sendPhoto.js.map +1 -0
  35. package/manifest.json +176 -0
  36. package/package.json +77 -0
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SendMessageTool = void 0;
4
+ /**
5
+ * Tool for sending text messages via Telegram
6
+ *
7
+ * @class SendMessageTool
8
+ * @implements {ITool}
9
+ */
10
+ class SendMessageTool {
11
+ /**
12
+ * Creates an instance of SendMessageTool
13
+ * @param {TelegramBotService} telegramService - The Telegram service
14
+ */
15
+ constructor(telegramService) {
16
+ this.telegramService = telegramService;
17
+ this.id = 'telegramSendMessage';
18
+ this.name = 'telegramSendMessage';
19
+ this.displayName = 'Send Telegram Message';
20
+ this.description = 'Send a text message to a Telegram chat or user. Supports Markdown and HTML formatting, reply to messages, and custom keyboards.';
21
+ this.category = 'communication';
22
+ this.version = '1.0.0';
23
+ this.hasSideEffects = true;
24
+ this.inputSchema = {
25
+ type: 'object',
26
+ required: ['chatId', 'text'],
27
+ properties: {
28
+ chatId: {
29
+ type: ['string', 'number'],
30
+ description: 'Unique identifier for the target chat or username of the target channel'
31
+ },
32
+ text: {
33
+ type: 'string',
34
+ description: 'Text of the message to be sent, 1-4096 characters'
35
+ },
36
+ parseMode: {
37
+ type: 'string',
38
+ enum: ['Markdown', 'HTML'],
39
+ description: 'Mode for parsing entities in the message text'
40
+ },
41
+ replyToMessageId: {
42
+ type: 'number',
43
+ description: 'If the message is a reply, ID of the original message'
44
+ },
45
+ disableNotification: {
46
+ type: 'boolean',
47
+ description: 'Sends the message silently'
48
+ },
49
+ replyMarkup: {
50
+ type: 'object',
51
+ description: 'Additional interface options (inline keyboard, custom reply keyboard, etc.)'
52
+ }
53
+ }
54
+ };
55
+ this.outputSchema = {
56
+ type: 'object',
57
+ properties: {
58
+ messageId: {
59
+ type: 'number',
60
+ description: 'Unique message identifier'
61
+ },
62
+ chatId: {
63
+ type: ['string', 'number'],
64
+ description: 'Chat where the message was sent'
65
+ },
66
+ date: {
67
+ type: 'number',
68
+ description: 'Date the message was sent in Unix time'
69
+ },
70
+ text: {
71
+ type: 'string',
72
+ description: 'The actual text of the message'
73
+ }
74
+ }
75
+ };
76
+ }
77
+ /**
78
+ * Executes the message sending
79
+ */
80
+ async execute(args, context) {
81
+ try {
82
+ // Validate text length
83
+ if (args.text.length > 4096) {
84
+ throw new Error('Message text too long (max 4096 characters)');
85
+ }
86
+ const message = await this.telegramService.sendMessage({
87
+ chatId: args.chatId,
88
+ text: args.text,
89
+ parseMode: args.parseMode,
90
+ replyToMessageId: args.replyToMessageId,
91
+ disableNotification: args.disableNotification,
92
+ replyMarkup: args.replyMarkup
93
+ });
94
+ return {
95
+ success: true,
96
+ output: {
97
+ messageId: message.message_id,
98
+ chatId: message.chat.id,
99
+ date: message.date,
100
+ text: message.text
101
+ }
102
+ };
103
+ }
104
+ catch (error) {
105
+ return {
106
+ success: false,
107
+ error: error.message,
108
+ details: {
109
+ code: error.code,
110
+ description: error.description
111
+ }
112
+ };
113
+ }
114
+ }
115
+ /**
116
+ * Validates input arguments
117
+ */
118
+ validateArgs(args) {
119
+ const errors = [];
120
+ if (!args.chatId) {
121
+ errors.push('chatId is required');
122
+ }
123
+ if (!args.text) {
124
+ errors.push('text is required');
125
+ }
126
+ else if (typeof args.text !== 'string') {
127
+ errors.push('text must be a string');
128
+ }
129
+ else if (args.text.length > 4096) {
130
+ errors.push('text exceeds maximum length of 4096 characters');
131
+ }
132
+ if (args.parseMode && !['Markdown', 'HTML'].includes(args.parseMode)) {
133
+ errors.push('parseMode must be either "Markdown" or "HTML"');
134
+ }
135
+ return {
136
+ isValid: errors.length === 0,
137
+ errors
138
+ };
139
+ }
140
+ }
141
+ exports.SendMessageTool = SendMessageTool;
142
+ //# sourceMappingURL=sendMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendMessage.js","sourceRoot":"","sources":["../../src/tools/sendMessage.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,MAAa,eAAe;IA+D1B;;;OAGG;IACH,YAAoB,eAAmC;QAAnC,oBAAe,GAAf,eAAe,CAAoB;QAlEvC,OAAE,GAAG,qBAAqB,CAAC;QAC3B,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AC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC;aAAM,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACrE,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC5B,MAAM;SACP,CAAC;IACJ,CAAC;CACF;AAlJD,0CAkJC"}
@@ -0,0 +1,54 @@
1
+ import { ITool, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
2
+ import { TelegramBotService } from '../services/telegramBot';
3
+ /**
4
+ * Tool for sending photos via Telegram
5
+ *
6
+ * @class SendPhotoTool
7
+ * @implements {ITool}
8
+ */
9
+ export declare class SendPhotoTool implements ITool {
10
+ private telegramService;
11
+ readonly id = "telegramSendPhoto";
12
+ readonly name = "telegramSendPhoto";
13
+ readonly displayName = "Send Telegram Photo";
14
+ readonly description = "Send a photo to a Telegram chat. Supports URLs, file paths, and base64 encoded images with optional captions.";
15
+ readonly category = "communication";
16
+ readonly version = "1.0.0";
17
+ readonly hasSideEffects = true;
18
+ readonly inputSchema: {
19
+ type: string;
20
+ required: string[];
21
+ properties: {
22
+ chatId: {
23
+ type: string[];
24
+ description: string;
25
+ };
26
+ photo: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ caption: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ parseMode: {
35
+ type: string;
36
+ enum: string[];
37
+ description: string;
38
+ };
39
+ replyToMessageId: {
40
+ type: string;
41
+ description: string;
42
+ };
43
+ };
44
+ };
45
+ constructor(telegramService: TelegramBotService);
46
+ execute(args: {
47
+ chatId: string | number;
48
+ photo: string;
49
+ caption?: string;
50
+ parseMode?: 'Markdown' | 'HTML';
51
+ replyToMessageId?: number;
52
+ }, context: ToolExecutionContext): Promise<ToolExecutionResult>;
53
+ }
54
+ //# sourceMappingURL=sendPhoto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendPhoto.d.ts","sourceRoot":"","sources":["../../src/tools/sendPhoto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,KAAK;IAqC7B,OAAO,CAAC,eAAe;IApCnC,SAAgB,EAAE,uBAAuB;IACzC,SAAgB,IAAI,uBAAuB;IAC3C,SAAgB,WAAW,yBAAyB;IACpD,SAAgB,WAAW,mHAAmH;IAC9I,SAAgB,QAAQ,mBAAmB;IAC3C,SAAgB,OAAO,WAAW;IAClC,SAAgB,cAAc,QAAQ;IAEtC,SAAgB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BzB;gBAEkB,eAAe,EAAE,kBAAkB;IAEjD,OAAO,CACX,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;QAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,EACD,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC;CAmChC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SendPhotoTool = void 0;
4
+ /**
5
+ * Tool for sending photos via Telegram
6
+ *
7
+ * @class SendPhotoTool
8
+ * @implements {ITool}
9
+ */
10
+ class SendPhotoTool {
11
+ constructor(telegramService) {
12
+ this.telegramService = telegramService;
13
+ this.id = 'telegramSendPhoto';
14
+ this.name = 'telegramSendPhoto';
15
+ this.displayName = 'Send Telegram Photo';
16
+ this.description = 'Send a photo to a Telegram chat. Supports URLs, file paths, and base64 encoded images with optional captions.';
17
+ this.category = 'communication';
18
+ this.version = '1.0.0';
19
+ this.hasSideEffects = true;
20
+ this.inputSchema = {
21
+ type: 'object',
22
+ required: ['chatId', 'photo'],
23
+ properties: {
24
+ chatId: {
25
+ type: ['string', 'number'],
26
+ description: 'Unique identifier for the target chat'
27
+ },
28
+ photo: {
29
+ type: 'string',
30
+ description: 'Photo URL, file path, or base64 encoded image'
31
+ },
32
+ caption: {
33
+ type: 'string',
34
+ description: 'Photo caption, 0-1024 characters'
35
+ },
36
+ parseMode: {
37
+ type: 'string',
38
+ enum: ['Markdown', 'HTML'],
39
+ description: 'Mode for parsing entities in the caption'
40
+ },
41
+ replyToMessageId: {
42
+ type: 'number',
43
+ description: 'If the message is a reply, ID of the original message'
44
+ }
45
+ }
46
+ };
47
+ }
48
+ async execute(args, context) {
49
+ try {
50
+ // Convert base64 to buffer if needed
51
+ let photoData = args.photo;
52
+ if (args.photo.startsWith('data:image/')) {
53
+ const base64Data = args.photo.split(',')[1];
54
+ photoData = Buffer.from(base64Data, 'base64');
55
+ }
56
+ const message = await this.telegramService.sendPhoto(args.chatId, photoData, {
57
+ caption: args.caption,
58
+ parseMode: args.parseMode,
59
+ replyToMessageId: args.replyToMessageId
60
+ });
61
+ return {
62
+ success: true,
63
+ output: {
64
+ messageId: message.message_id,
65
+ chatId: message.chat.id,
66
+ date: message.date
67
+ }
68
+ };
69
+ }
70
+ catch (error) {
71
+ return {
72
+ success: false,
73
+ error: error.message,
74
+ details: { code: error.code }
75
+ };
76
+ }
77
+ }
78
+ }
79
+ exports.SendPhotoTool = SendPhotoTool;
80
+ //# sourceMappingURL=sendPhoto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendPhoto.js","sourceRoot":"","sources":["../../src/tools/sendPhoto.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,MAAa,aAAa;IAqCxB,YAAoB,eAAmC;QAAnC,oBAAe,GAAf,eAAe,CAAoB;QApCvC,OAAE,GAAG,mBAAmB,CAAC;QACzB,SAAI,GAAG,mBAAmB,CAAC;QAC3B,gBAAW,GAAG,qBAAqB,CAAC;QACpC,gBAAW,GAAG,+GAA+G,CAAC;QAC9H,aAAQ,GAAG,eAAe,CAAC;QAC3B,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,IAAI,CAAC;QAEtB,gBAAW,GAAG;YAC5B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;YAC7B,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;oBAC1B,WAAW,EAAE,uCAAuC;iBACrD;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,+CAA+C;iBAC7D;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kCAAkC;iBAChD;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;oBAC1B,WAAW,EAAE,0CAA0C;iBACxD;gBACD,gBAAgB,EAAE;oBAChB,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,uDAAuD;iBACrE;aACF;SACF,CAAC;IAEwD,CAAC;IAE3D,KAAK,CAAC,OAAO,CACX,IAMC,EACD,OAA6B;QAE7B,IAAI,CAAC;YACH,qCAAqC;YACrC,IAAI,SAAS,GAAoB,IAAI,CAAC,KAAK,CAAC;YAC5C,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5C,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAChD,CAAC;YAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAClD,IAAI,CAAC,MAAM,EACX,SAAS,EACT;gBACE,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;aACxC,CACF,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE;oBACN,SAAS,EAAE,OAAO,CAAC,UAAU;oBAC7B,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE;oBACvB,IAAI,EAAE,OAAO,CAAC,IAAI;iBACnB;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK,CAAC,OAAO;gBACpB,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAnFD,sCAmFC"}
package/manifest.json ADDED
@@ -0,0 +1,176 @@
1
+ {
2
+ "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
+ "id": "com.framers.integrations.telegram",
4
+ "name": "Telegram Bot Extension",
5
+ "version": "1.0.0",
6
+ "description": "Professional Telegram Bot API integration for AgentOS - send messages, manage groups, handle callbacks",
7
+ "author": {
8
+ "name": "Frame.dev",
9
+ "email": "support@frame.dev",
10
+ "url": "https://github.com/framersai"
11
+ },
12
+ "license": "MIT",
13
+ "keywords": ["telegram", "bot", "messaging", "chat", "communication", "integration"],
14
+ "agentosVersion": "^2.0.0",
15
+ "categories": ["communication", "integration"],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/framersai/agentos-extensions"
19
+ },
20
+ "extensions": [
21
+ {
22
+ "kind": "tool",
23
+ "id": "telegramSendMessage",
24
+ "displayName": "Send Telegram Message",
25
+ "description": "Send formatted text messages to Telegram chats",
26
+ "entry": "./dist/tools/sendMessage.js",
27
+ "schema": {
28
+ "input": {
29
+ "type": "object",
30
+ "required": ["chatId", "text"],
31
+ "properties": {
32
+ "chatId": { "type": ["string", "number"] },
33
+ "text": { "type": "string" },
34
+ "parseMode": { "type": "string", "enum": ["Markdown", "HTML"] }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "kind": "tool",
41
+ "id": "telegramSendPhoto",
42
+ "displayName": "Send Telegram Photo",
43
+ "description": "Send photos with captions to Telegram chats",
44
+ "entry": "./dist/tools/sendPhoto.js",
45
+ "schema": {
46
+ "input": {
47
+ "type": "object",
48
+ "required": ["chatId", "photo"],
49
+ "properties": {
50
+ "chatId": { "type": ["string", "number"] },
51
+ "photo": { "type": "string" },
52
+ "caption": { "type": "string" }
53
+ }
54
+ }
55
+ }
56
+ },
57
+ {
58
+ "kind": "tool",
59
+ "id": "telegramSendDocument",
60
+ "displayName": "Send Telegram Document",
61
+ "description": "Send documents and files to Telegram chats",
62
+ "entry": "./dist/tools/sendDocument.js",
63
+ "schema": {
64
+ "input": {
65
+ "type": "object",
66
+ "required": ["chatId", "document"],
67
+ "properties": {
68
+ "chatId": { "type": ["string", "number"] },
69
+ "document": { "type": "string" },
70
+ "filename": { "type": "string" }
71
+ }
72
+ }
73
+ }
74
+ },
75
+ {
76
+ "kind": "tool",
77
+ "id": "telegramGetChatInfo",
78
+ "displayName": "Get Telegram Chat Info",
79
+ "description": "Retrieve information about a Telegram chat",
80
+ "entry": "./dist/tools/getChatInfo.js",
81
+ "schema": {
82
+ "input": {
83
+ "type": "object",
84
+ "required": ["chatId"],
85
+ "properties": {
86
+ "chatId": { "type": ["string", "number"] },
87
+ "includeMemberCount": { "type": "boolean" }
88
+ }
89
+ }
90
+ }
91
+ },
92
+ {
93
+ "kind": "tool",
94
+ "id": "telegramManageGroup",
95
+ "displayName": "Manage Telegram Group",
96
+ "description": "Perform admin actions in Telegram groups",
97
+ "entry": "./dist/tools/manageGroup.js",
98
+ "schema": {
99
+ "input": {
100
+ "type": "object",
101
+ "required": ["chatId", "action"],
102
+ "properties": {
103
+ "chatId": { "type": ["string", "number"] },
104
+ "action": { "type": "string", "enum": ["pinMessage", "unpinMessage", "setDescription", "setTitle"] }
105
+ }
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "kind": "tool",
111
+ "id": "telegramHandleCallback",
112
+ "displayName": "Handle Telegram Callback",
113
+ "description": "Handle callback queries from inline keyboards",
114
+ "entry": "./dist/tools/handleCallback.js",
115
+ "schema": {
116
+ "input": {
117
+ "type": "object",
118
+ "required": ["callbackQueryId"],
119
+ "properties": {
120
+ "callbackQueryId": { "type": "string" },
121
+ "text": { "type": "string" },
122
+ "showAlert": { "type": "boolean" }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ ],
128
+ "features": [
129
+ "Send messages, photos, and documents",
130
+ "Manage groups (pin, descriptions, titles)",
131
+ "Handle inline keyboard callbacks",
132
+ "Flexible bot token configuration (env vars)",
133
+ "Rate limiting and queue management",
134
+ "Webhook and polling support",
135
+ "Markdown and HTML formatting"
136
+ ],
137
+ "configuration": {
138
+ "properties": {
139
+ "telegram.botToken": {
140
+ "type": "string",
141
+ "description": "Telegram Bot API token",
142
+ "secret": true
143
+ },
144
+ "telegram.botTokenEnv": {
145
+ "type": "string",
146
+ "default": "TELEGRAM_BOT_TOKEN",
147
+ "description": "Environment variable name for bot token"
148
+ },
149
+ "telegram.webhookUrl": {
150
+ "type": "string",
151
+ "description": "Webhook URL for receiving updates"
152
+ },
153
+ "telegram.pollingInterval": {
154
+ "type": "number",
155
+ "default": 300,
156
+ "description": "Polling interval in milliseconds"
157
+ },
158
+ "telegram.parseMode": {
159
+ "type": "string",
160
+ "enum": ["Markdown", "HTML"],
161
+ "default": "Markdown",
162
+ "description": "Default message parse mode"
163
+ },
164
+ "telegram.rateLimit.maxRequests": {
165
+ "type": "number",
166
+ "default": 30,
167
+ "description": "Maximum requests per window"
168
+ },
169
+ "telegram.rateLimit.windowMs": {
170
+ "type": "number",
171
+ "default": 1000,
172
+ "description": "Rate limit window in milliseconds"
173
+ }
174
+ }
175
+ }
176
+ }
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@framers/agentos-ext-telegram",
3
+ "version": "1.1.0",
4
+ "description": "Telegram Bot API integration for AgentOS - send messages, manage groups, handle callbacks",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "dev": "tsc --watch",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest watch",
12
+ "test:coverage": "vitest run --coverage",
13
+ "lint": "eslint src test --ext .ts",
14
+ "lint:fix": "eslint src test --ext .ts --fix",
15
+ "clean": "rm -rf dist coverage",
16
+ "docs": "typedoc --out docs src/index.ts"
17
+ },
18
+ "keywords": [
19
+ "agentos",
20
+ "extension",
21
+ "telegram",
22
+ "bot",
23
+ "messaging",
24
+ "chat",
25
+ "integration"
26
+ ],
27
+ "author": {
28
+ "name": "Framers AI",
29
+ "email": "team@frame.dev",
30
+ "url": "https://frame.dev"
31
+ },
32
+ "contributors": [
33
+ {
34
+ "name": "Johnny Dunn",
35
+ "email": "johnnyfived@protonmail.com",
36
+ "url": "https://github.com/jddunn"
37
+ }
38
+ ],
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/framersai/agentos-extensions",
43
+ "directory": "registry/curated/integrations/telegram"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "manifest.json",
48
+ "README.md"
49
+ ],
50
+ "peerDependencies": {
51
+ "@framers/agentos": "^0.1.0"
52
+ },
53
+ "dependencies": {
54
+ "telegraf": "^4.15.0",
55
+ "node-telegram-bot-api": "^0.64.0",
56
+ "dotenv": "^16.3.0"
57
+ },
58
+ "devDependencies": {
59
+ "@framers/agentos": "^0.1.0",
60
+ "@types/node": "^20.0.0",
61
+ "@types/node-telegram-bot-api": "^0.64.0",
62
+ "typescript": "^5.0.0",
63
+ "vitest": "^1.0.0",
64
+ "@vitest/coverage-v8": "^1.0.0",
65
+ "eslint": "^8.0.0",
66
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
67
+ "@typescript-eslint/parser": "^6.0.0",
68
+ "typedoc": "^0.25.0"
69
+ },
70
+ "engines": {
71
+ "node": ">=18.0.0"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public",
75
+ "registry": "https://registry.npmjs.org/"
76
+ }
77
+ }