@pipedream/telegram_bot_api 0.3.11 → 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.
- package/README.md +9 -10
- package/package.json +2 -2
- package/sources/message-updates/message-updates.mjs +33 -1
package/README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# Overview
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
-
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/telegram_bot_api",
|
|
3
|
-
"version": "0.3.
|
|
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.
|
|
13
|
+
"@pipedream/platform": "^3.0.3",
|
|
14
14
|
"node-telegram-bot-api": "^0.54.0",
|
|
15
15
|
"uuid": "^8.3.2"
|
|
16
16
|
},
|
|
@@ -6,11 +6,37 @@ export default {
|
|
|
6
6
|
key: "telegram_bot_api-message-updates",
|
|
7
7
|
name: "New Message Updates (Instant)",
|
|
8
8
|
description: "Emit new event each time a Telegram message is created or updated.",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.6",
|
|
10
10
|
type: "source",
|
|
11
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
|
+
},
|
|
12
32
|
methods: {
|
|
13
33
|
...base.methods,
|
|
34
|
+
_getChatId() {
|
|
35
|
+
return this.db.get("chatId");
|
|
36
|
+
},
|
|
37
|
+
_setChatId(chatId) {
|
|
38
|
+
this.db.set("chatId", chatId);
|
|
39
|
+
},
|
|
14
40
|
getMeta(event, message) {
|
|
15
41
|
return {
|
|
16
42
|
id: event.update_id,
|
|
@@ -26,6 +52,12 @@ export default {
|
|
|
26
52
|
},
|
|
27
53
|
processEvent(event) {
|
|
28
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
|
+
}
|
|
29
61
|
this.$emit(event, this.getMeta(event, message));
|
|
30
62
|
},
|
|
31
63
|
},
|