@frogbotai/piece-telegram-bot 0.22.0 → 0.23.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.
- package/README.md +62 -0
- package/dist/actions/index.d.ts +1274 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +267 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +65 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +16 -0
- package/dist/config.js.map +1 -0
- package/dist/files.d.ts +11 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +56 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +1319 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -60
- package/dist/index.js.map +1 -1
- package/dist/triggers/newUpdate.d.ts +25 -0
- package/dist/triggers/newUpdate.d.ts.map +1 -0
- package/dist/triggers/newUpdate.js +50 -0
- package/dist/triggers/newUpdate.js.map +1 -0
- package/dist/webhook.d.ts +11 -0
- package/dist/webhook.d.ts.map +1 -0
- package/dist/webhook.js +15 -0
- package/dist/webhook.js.map +1 -0
- package/package.json +6 -5
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# `@frogbotai/piece-telegram-bot`
|
|
2
|
+
|
|
3
|
+
Send Telegram Bot API requests and receive bot updates through FrogBot.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createTelegramBot } from '@frogbotai/piece-telegram-bot';
|
|
9
|
+
|
|
10
|
+
export const telegramBot = createTelegramBot({
|
|
11
|
+
auth: { botToken: process.env.TELEGRAM_BOT_TOKEN! },
|
|
12
|
+
webhookSecret: process.env.TELEGRAM_WEBHOOK_SECRET!,
|
|
13
|
+
botUsername: 'frogbot',
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
1. Create a bot with [BotFather](https://t.me/BotFather) and copy its bot token.
|
|
20
|
+
2. Choose a webhook secret containing only letters, numbers, underscores, or hyphens. Keep it private.
|
|
21
|
+
3. Register `https://<your-host>/api/webhooks/<piece-instance-slug>` with Telegram's `setWebhook` method and pass the same value as `secret_token`.
|
|
22
|
+
4. Add `message`, `edited_message`, `channel_post`, `edited_channel_post`, and `callback_query` to `allowed_updates`. Add any other update types used by `newUpdate`.
|
|
23
|
+
5. Disable privacy mode with BotFather when the bot must receive ordinary group messages. Add the bot to each group or channel with the permissions needed to read and reply.
|
|
24
|
+
6. Mount the instance in the agent's `channels: [telegramBot]` and explicitly configure the agent's `access` callback to permit the intended anonymous participants.
|
|
25
|
+
|
|
26
|
+
Telegram does not use a webhook challenge handshake. FrogBot verifies every delivery with the `X-Telegram-Bot-Api-Secret-Token` header. Set `allowedUserIds` to restrict channel conversations to known Telegram user IDs; omitted or empty values allow every Telegram user to reach the bot, subject to your FrogBot agent access rules.
|
|
27
|
+
|
|
28
|
+
Allowlisting does not authenticate a FrogBot user. Telegram channel identity always returns `null`, so default agent access denies even allowlisted users. For an intentionally public agent, `access: () => true` permits anonymous use on every agent entry point. For restricted access, use a callback that checks the intended channel and participant through `req.context.channel`; keep `allowedUserIds` configured as the Telegram-side filter.
|
|
29
|
+
|
|
30
|
+
Telegram permits one webhook per bot token. The channel adapter and `newUpdate` share the instance webhook above; do not register a separate subscription URL. Direct messages, groups, and each forum topic remain separate conversations.
|
|
31
|
+
|
|
32
|
+
The Start button (`/start`) and other direct-message commands reach the agent with their command text and arguments intact. Group commands addressed to `@<botUsername>` use the same mention and conversation routing as ordinary messages.
|
|
33
|
+
|
|
34
|
+
## Actions
|
|
35
|
+
|
|
36
|
+
| Upstream action slug | Previous wrapper export | Native action | Notes |
|
|
37
|
+
| ----------------------- | ----------------------- | --------------------- | ---------------------------------- |
|
|
38
|
+
| `send_text_message` | `sendTextMessage` | `sendTextMessage` | |
|
|
39
|
+
| `send_media` | `sendMedia` | `sendMedia` | Accepts a Telegram file ID or URL. |
|
|
40
|
+
| `send_document` | `sendDocument` | `sendDocument` | Accepts a Telegram file ID or URL. |
|
|
41
|
+
| `send_audio` | `sendAudio` | `sendAudio` | Accepts a Telegram file ID or URL. |
|
|
42
|
+
| `send_location` | `sendLocation` | `sendLocation` | |
|
|
43
|
+
| `send_media_group` | `sendMediaGroup` | `sendMediaGroup` | Accepts Telegram file IDs or URLs. |
|
|
44
|
+
| `send_poll` | `sendPoll` | `sendPoll` | |
|
|
45
|
+
| `send_chat_action` | `sendChatAction` | `sendChatAction` | |
|
|
46
|
+
| `edit_message_text` | `editMessageText` | `editMessageText` | |
|
|
47
|
+
| `delete_message` | `deleteMessage` | `deleteMessage` | |
|
|
48
|
+
| `forward_message` | `forwardMessage` | `forwardMessage` | |
|
|
49
|
+
| `pin_message` | `pinMessage` | `pinMessage` | |
|
|
50
|
+
| `unpin_message` | `unpinMessage` | `unpinMessage` | |
|
|
51
|
+
| `get_chat` | `getChat` | `getChat` | |
|
|
52
|
+
| `get_chat_member` | `getChatMember` | `getChatMember` | |
|
|
53
|
+
| `get_file` | `getFile` | `getFile` | Returns Telegram file metadata. |
|
|
54
|
+
| `create_invite_link` | `createInviteLink` | `createInviteLink` | |
|
|
55
|
+
| `answer_callback_query` | `answerCallbackQuery` | `answerCallbackQuery` | |
|
|
56
|
+
| `custom_api_call` | `customApiCall` | `customApiCall` | |
|
|
57
|
+
|
|
58
|
+
## Triggers
|
|
59
|
+
|
|
60
|
+
| Upstream trigger slug | Native trigger | Type | Notes |
|
|
61
|
+
| ---------------------- | -------------- | ----- | ------------------------------------------------------------ |
|
|
62
|
+
| `new_telegram_message` | `newUpdate` | `app` | Filters update types received by the shared channel webhook. |
|