@pipedream/telegram_bot_api 0.3.10 → 0.3.12

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/README.md +9 -10
  2. package/actions/create-chat-invite-link/create-chat-invite-link.mjs +1 -1
  3. package/actions/delete-message/delete-message.mjs +1 -1
  4. package/actions/edit-media-message/edit-media-message.mjs +1 -1
  5. package/actions/edit-text-message/edit-text-message.mjs +1 -1
  6. package/actions/export-chat-invite-link/export-chat-invite-link.mjs +1 -1
  7. package/actions/forward-message/forward-message.mjs +1 -1
  8. package/actions/get-num-members-in-chat/get-num-members-in-chat.mjs +1 -1
  9. package/actions/kick-chat-member/kick-chat-member.mjs +1 -1
  10. package/actions/list-administrators-in-chat/list-administrators-in-chat.mjs +1 -1
  11. package/actions/list-chats/list-chats.mjs +1 -1
  12. package/actions/list-updates/list-updates.mjs +1 -1
  13. package/actions/pin-message/pin-message.mjs +1 -1
  14. package/actions/promote-chat-member/promote-chat-member.mjs +1 -1
  15. package/actions/restrict-chat-member/restrict-chat-member.mjs +1 -1
  16. package/actions/send-album/send-album.mjs +1 -1
  17. package/actions/send-audio-file/send-audio-file.mjs +1 -1
  18. package/actions/send-document-or-image/send-document-or-image.mjs +1 -1
  19. package/actions/send-media-by-url-or-id/send-media-by-url-or-id.mjs +1 -1
  20. package/actions/send-photo/send-photo.mjs +1 -1
  21. package/actions/send-sticker/send-sticker.mjs +1 -1
  22. package/actions/send-text-message-or-reply/send-text-message-or-reply.mjs +4 -4
  23. package/actions/send-video/send-video.mjs +1 -1
  24. package/actions/send-video-note/send-video-note.mjs +1 -1
  25. package/actions/send-voice-message/send-voice-message.mjs +1 -1
  26. package/actions/set-chat-permissions/set-chat-permissions.mjs +1 -1
  27. package/actions/unpin-message/unpin-message.mjs +1 -1
  28. package/package.json +2 -2
  29. package/sources/channel-updates/channel-updates.mjs +1 -1
  30. package/sources/message-updates/message-updates.mjs +35 -1
  31. package/sources/message-updates/test-event.mjs +23 -0
  32. package/sources/new-bot-command-received/new-bot-command-received.mjs +3 -1
  33. package/sources/new-bot-command-received/test-event.mjs +30 -0
  34. package/sources/new-updates/new-updates.mjs +3 -1
  35. package/sources/new-updates/test-event.mjs +23 -0
  36. package/telegram_bot_api.app.mjs +7 -4
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # Overview
2
2
 
3
- With the Telegram Bot API, you can build bots that perform a variety of tasks,
4
- including:
5
-
6
- - Sending and receiving messages
7
- - Social networking
8
- - Content management
9
- - File sharing
10
- - Location sharing
11
- - Bot administration
12
- - And more!
3
+ The Telegram Bot API allows you to build bots that can interact with users on the Telegram platform. Using Pipedream, you can automate messaging, handle commands, and trigger actions based on conversations or alerts. Pipedream's serverless execution model enables you to create complex workflows involving Telegram messages without managing any infrastructure. With Pipedream's integration, you can process inbound messages, send outbound notifications, and connect the Telegram Bot API with numerous other services to create powerful automation solutions.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Customer Support Ticketing**: Automate the creation of customer support tickets from Telegram messages. When a user sends a support request to your Telegram bot, Pipedream can capture the message and create a ticket in a service like Zendesk or Jira, assigning it to the appropriate team and sending a confirmation message back to the user.
8
+
9
+ - **Content Distribution Network**: Use your Telegram bot to distribute content automatically. Pipedream can listen for new posts or updates from your CMS, such as WordPress, and then push that content to a Telegram channel or chat. This workflow is useful for bloggers, news agencies, or anyone wanting to keep their audience informed in real-time.
10
+
11
+ - **E-commerce Order Notifications**: Send order updates or confirmations to customers via Telegram. When a new order is placed on your e-commerce platform, like Shopify, Pipedream can trigger a workflow that sends a personalized message to the customer's Telegram account, providing them peace of mind and enhancing the overall shopping experience.
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-create-chat-invite-link",
5
5
  name: "Create Chat Invite Link",
6
6
  description: "Create an additional invite link for a chat, [See the docs](https://core.telegram.org/bots/api#createchatinvitelink) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-delete-message",
5
5
  name: "Delete a Message",
6
6
  description: "Deletes a message. [See the docs](https://core.telegram.org/bots/api#deletemessage) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "telegram_bot_api-edit-media-message",
9
9
  name: "Edit a Media Message",
10
10
  description: "Edits photo or video messages. [See the docs](https://core.telegram.org/bots/api#editmessagemedia) for more information",
11
- version: "0.0.5",
11
+ version: "0.0.6",
12
12
  type: "action",
13
13
  props: {
14
14
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-edit-text-message",
5
5
  name: "Edit a Text Message",
6
6
  description: "Edits text or game messages. [See the docs](https://core.telegram.org/bots/api#editmessagetext) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-export-chat-invite-link",
5
5
  name: "Export Chat Invite Link",
6
6
  description: "Generate a new primary invite link for a chat, [See the docs](https://core.telegram.org/bots/api#createchatinvitelink) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-forward-message",
5
5
  name: "Forward a Message",
6
6
  description: "Forwards messages of any kind. [See the docs](https://core.telegram.org/bots/api#forwardmessage) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-get-num-members-in-chat",
5
5
  name: "Get the Number of Members in a Chat",
6
6
  description: "Use this module to get the number of members in a chat. [See the docs](https://core.telegram.org/bots/api#getchatmembercount) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-kick-chat-member",
5
5
  name: "Kick a Chat Member",
6
6
  description: "Use this method to kick a user from a group, a supergroup or channel. [See the docs](https://core.telegram.org/bots/api#banchatmember) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-list-administrators-in-chat",
5
5
  name: "List Administrators In Chat",
6
6
  description: "Use this module to get a list of administrators in a chat. [See the docs](https://core.telegram.org/bots/api#getchatadministrators) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-list-chats",
5
5
  name: "List Chats",
6
6
  description: "List available Telegram chats. [See the docs](https://core.telegram.org/bots/api#getupdates) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-list-updates",
5
5
  name: "List Updates",
6
6
  description: "Retrieves a list of updates from the Telegram server. [See the docs](https://core.telegram.org/bots/api#getupdates) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-pin-message",
5
5
  name: "Pin a Message",
6
6
  description: "Pins a message. [See the docs](https://core.telegram.org/bots/api#pinchatmessage) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-promote-chat-member",
5
5
  name: "Promote a Chat Member",
6
6
  description: "Use this method to promote or demote a user in a supergroup or a channel. [See the docs](https://core.telegram.org/bots/api#promotechatmember) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-restrict-chat-member",
5
5
  name: "Restrict a Chat Member",
6
6
  description: "Use this method to restrict a user in a supergroup. [See the docs](https://core.telegram.org/bots/api#restrictchatmember) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-album",
6
6
  name: "Send an Album (Media Group)",
7
7
  description: "Sends a group of photos or videos as an album. [See the docs](https://core.telegram.org/bots/api#sendmediagroup) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-audio-file",
6
6
  name: "Send an Audio File",
7
7
  description: "Sends an audio file to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendaudio) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-document-or-image",
6
6
  name: "Send a Document/Image",
7
7
  description: "Sends a document or an image to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#senddocument) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-media-by-url-or-id",
6
6
  name: "Send Media by URL or ID",
7
7
  description: "Sends a file (document, photo, video, audio, ...) by HTTP URL or by ID that exists on the Telegram servers. [See the docs](https://core.telegram.org/bots/api#inputmedia) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-photo",
6
6
  name: "Send a Photo",
7
7
  description: "Sends a photo to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendphoto) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-send-sticker",
5
5
  name: "Send a Sticker",
6
6
  description: "Sends a .webp sticker to you Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendsticker) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-send-text-message-or-reply",
5
5
  name: "Send a Text Message or Reply",
6
6
  description: "Sends a text message or a reply to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendmessage) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -32,10 +32,10 @@ export default {
32
32
  "disable_notification",
33
33
  ],
34
34
  },
35
- disable_web_page_preview: {
35
+ link_preview_options: {
36
36
  propDefinition: [
37
37
  telegramBotApi,
38
- "disable_web_page_preview",
38
+ "link_preview_options",
39
39
  ],
40
40
  },
41
41
  reply_to_message_id: {
@@ -55,7 +55,7 @@ export default {
55
55
  const resp = await this.telegramBotApi.sendMessage(this.chatId, this.text, {
56
56
  parse_mode: this.parse_mode,
57
57
  disable_notification: this.disable_notification,
58
- disable_web_page_preview: this.disable_web_page_preview,
58
+ link_preview_options: this.link_preview_options,
59
59
  reply_to_message_id: this.reply_to_message_id,
60
60
  reply_markup: this.reply_markup,
61
61
  });
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-video",
6
6
  name: "Send a Video",
7
7
  description: "Sends a video file to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendvideo) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-video-note",
6
6
  name: "Send a Video Note",
7
7
  description: "As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. [See the docs](https://core.telegram.org/bots/api#sendvideonote) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "telegram_bot_api-send-voice-message",
6
6
  name: "Send a Voice Message",
7
7
  description: "Sends a voice message. [See the docs](https://core.telegram.org/bots/api#sendvoice) for more information",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  type: "action",
10
10
  props: {
11
11
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-set-chat-permissions",
5
5
  name: "Set Chat Permissions",
6
6
  description: "Set default chat permissions for all members. [See the docs](https://core.telegram.org/bots/api#setchatpermissions) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "telegram_bot_api-unpin-message",
5
5
  name: "Unpin a Message",
6
6
  description: "Unpins a message. [See the docs](https://core.telegram.org/bots/api#unpinchatmessage) for more information",
7
- version: "0.0.4",
7
+ version: "0.0.5",
8
8
  type: "action",
9
9
  props: {
10
10
  telegramBotApi,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/telegram_bot_api",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "Pipedream Telegram_bot_api Components",
5
5
  "main": "telegram_bot_api.app.mjs",
6
6
  "keywords": [
@@ -10,7 +10,7 @@
10
10
  "homepage": "https://pipedream.com/apps/telegram_bot_api",
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "dependencies": {
13
- "@pipedream/platform": "^0.9.0",
13
+ "@pipedream/platform": "^3.0.3",
14
14
  "node-telegram-bot-api": "^0.54.0",
15
15
  "uuid": "^8.3.2"
16
16
  },
@@ -6,7 +6,7 @@ export default {
6
6
  key: "telegram_bot_api-channel-updates",
7
7
  name: "New Channel Updates (Instant)",
8
8
  description: "Emit new event each time a channel post is created or updated.",
9
- version: "0.1.4",
9
+ version: "0.1.5",
10
10
 
11
11
  type: "source",
12
12
  dedupe: "unique",
@@ -1,15 +1,42 @@
1
1
  import base from "../common/webhooks.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...base,
5
6
  key: "telegram_bot_api-message-updates",
6
7
  name: "New Message Updates (Instant)",
7
8
  description: "Emit new event each time a Telegram message is created or updated.",
8
- version: "0.1.3",
9
+ version: "0.1.6",
9
10
  type: "source",
10
11
  dedupe: "unique",
12
+ props: {
13
+ ...base.props,
14
+ chatId: {
15
+ propDefinition: [
16
+ base.props.telegramBotApi,
17
+ "chatId",
18
+ ],
19
+ optional: true,
20
+ },
21
+ },
22
+ hooks: {
23
+ ...base.hooks,
24
+ async deploy() {
25
+ if (this.chatId) {
26
+ const { id } = await this.telegramBotApi.sdk().getChat(this.chatId);
27
+ this._setChatId(id);
28
+ }
29
+ await base.hooks.deploy.call(this);
30
+ },
31
+ },
11
32
  methods: {
12
33
  ...base.methods,
34
+ _getChatId() {
35
+ return this.db.get("chatId");
36
+ },
37
+ _setChatId(chatId) {
38
+ this.db.set("chatId", chatId);
39
+ },
13
40
  getMeta(event, message) {
14
41
  return {
15
42
  id: event.update_id,
@@ -25,7 +52,14 @@ export default {
25
52
  },
26
53
  processEvent(event) {
27
54
  const message = event.edited_message ?? event.message;
55
+ if (this.chatId) {
56
+ const chatId = this._getChatId();
57
+ if (chatId && chatId != message?.chat?.id) {
58
+ return;
59
+ }
60
+ }
28
61
  this.$emit(event, this.getMeta(event, message));
29
62
  },
30
63
  },
64
+ sampleEmit,
31
65
  };
@@ -0,0 +1,23 @@
1
+ export default {
2
+ "update_id": 385937742,
3
+ "message": {
4
+ "message_id": 45,
5
+ "from": {
6
+ "id": 762444944,
7
+ "is_bot": false,
8
+ "first_name": "James",
9
+ "last_name": "Smith",
10
+ "username": "smithjames",
11
+ "language_code": "fr"
12
+ },
13
+ "chat": {
14
+ "id": 762444944,
15
+ "first_name": "James",
16
+ "last_name": "Smith",
17
+ "username": "smithjames",
18
+ "type": "private"
19
+ },
20
+ "date": 1787956925,
21
+ "text": "What's happening?"
22
+ }
23
+ }
@@ -1,11 +1,12 @@
1
1
  import base from "../common/webhooks.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...base,
5
6
  key: "telegram_bot_api-new-bot-command-received",
6
7
  name: "New Bot Command Received (Instant)",
7
8
  description: "Emit new event each time a Telegram Bot command is received.",
8
- version: "0.0.3",
9
+ version: "0.0.5",
9
10
  type: "source",
10
11
  dedupe: "unique",
11
12
  props: {
@@ -55,4 +56,5 @@ export default {
55
56
  this.$emit(event, this.getMeta(event, message));
56
57
  },
57
58
  },
59
+ sampleEmit,
58
60
  };
@@ -0,0 +1,30 @@
1
+ export default {
2
+ "update_id": 999999999,
3
+ "message": {
4
+ "message_id": 99,
5
+ "from": {
6
+ "id": 100000000,
7
+ "is_bot": false,
8
+ "first_name": "John",
9
+ "last_name": "Doe",
10
+ "username": "johndoe",
11
+ "language_code": "en"
12
+ },
13
+ "chat": {
14
+ "id": 100000000,
15
+ "first_name": "John",
16
+ "last_name": "Doe",
17
+ "username": "johndoe",
18
+ "type": "private"
19
+ },
20
+ "date": 2000000000,
21
+ "text": "/test",
22
+ "entities": [
23
+ {
24
+ "offset": 0,
25
+ "length": 5,
26
+ "type": "bot_command"
27
+ }
28
+ ]
29
+ }
30
+ }
@@ -1,11 +1,12 @@
1
1
  import base from "../common/webhooks.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...base,
5
6
  key: "telegram_bot_api-new-updates",
6
7
  name: "New Updates (Instant)",
7
8
  description: "Emit new event for each new Telegram event.",
8
- version: "0.1.3",
9
+ version: "0.1.5",
9
10
  type: "source",
10
11
  dedupe: "unique",
11
12
  props: {
@@ -41,4 +42,5 @@ export default {
41
42
  this.$emit(event, this.getMeta(event));
42
43
  },
43
44
  },
45
+ sampleEmit,
44
46
  };
@@ -0,0 +1,23 @@
1
+ export default {
2
+ "update_id": 548364579,
3
+ "message": {
4
+ "message_id": 74,
5
+ "from": {
6
+ "id": 364712354,
7
+ "is_bot": false,
8
+ "first_name": "John",
9
+ "last_name": "Doe",
10
+ "username": "johndoe123",
11
+ "language_code": "en"
12
+ },
13
+ "chat": {
14
+ "id": 364712354,
15
+ "first_name": "John",
16
+ "last_name": "Doe",
17
+ "username": "johndoe123",
18
+ "type": "private"
19
+ },
20
+ "date": 1789758645,
21
+ "text": "Haha what is up?"
22
+ }
23
+ }
@@ -62,10 +62,13 @@ export default {
62
62
  `),
63
63
  optional: true,
64
64
  },
65
- disable_web_page_preview: {
66
- type: "boolean",
67
- label: "Disable Link Previews",
68
- description: "Choose if to disable link previews for links in this message.",
65
+ link_preview_options: {
66
+ type: "string",
67
+ label: "Link Preview Options",
68
+ description: toSingleLineString(`
69
+ Link preview generation options for the message. Enter additional interface options that are a JSON-serialized object,
70
+ e.g. \`{"is_disabled":false,"url":"https://botpress.org","prefer_small_media":true,"prefer_large_media":false,"show_above_text":false}\`
71
+ `),
69
72
  optional: true,
70
73
  },
71
74
  reply_to_message_id: {