Skip to content

Commit 6634864

Browse files
authored
Trengo - new components (#18322)
* new components * versions * updates
1 parent c2c646a commit 6634864

File tree

21 files changed

+186
-33
lines changed

21 files changed

+186
-33
lines changed

components/trengo/actions/create-contact/create-contact.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import app from "../../trengo.app.mjs";
33
export default {
44
type: "action",
55
key: "trengo-create-contact",
6-
version: "0.0.3",
6+
version: "0.0.4",
77
name: "Create Contact",
8-
description: "Creates a contact. If a contact with given identifier already exists, returns it. [See the docs](https://developers.trengo.com/reference/create-update-a-user)",
8+
description: "Creates a contact. If a contact with given identifier already exists, returns it. [See the documentation](https://developers.trengo.com/reference/create-contact)",
99
props: {
1010
app,
1111
channelId: {

components/trengo/actions/find-contacts/find-contacts.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-find-contacts",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
name: "Find Contacts",
9-
description: "Finds contacts with the given term. [See the docs](https://developers.trengo.com/reference/as)",
9+
description: "Finds contacts with the given term. [See the documentation](https://developers.trengo.com/reference/list-all-contacts)",
1010
props: {
1111
app,
1212
term: {

components/trengo/actions/list-articles/list-articles.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-list-articles",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
name: "List Articles",
9-
description: "List articles from a help center according to the specified criteria. [See the docs](https://developers.trengo.com/reference/list-all-articles)",
9+
description: "List articles from a help center according to the specified criteria. [See the documentation](https://developers.trengo.com/reference/list-all-articles)",
1010
props: {
1111
app,
1212
helpCenterId: {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import utils from "../../common/utils.mjs";
2+
import app from "../../trengo.app.mjs";
3+
4+
export default {
5+
key: "trengo-list-messages",
6+
name: "List Messages",
7+
description: "List messages from a ticket. [See the documentation](https://developers.trengo.com/reference/list-all-messages)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
ticketId: {
13+
propDefinition: [
14+
app,
15+
"ticketId",
16+
],
17+
},
18+
maxResults: {
19+
type: "integer",
20+
label: "Max Results",
21+
description: "Maximum number of messages to return (if not specified, all results will be returned)",
22+
optional: true,
23+
},
24+
},
25+
async run({ $ }) {
26+
const messages = [];
27+
const resourcesStream = utils.getResourcesStream({
28+
resourceFn: this.app.getMessages,
29+
resourceFnArgs: {
30+
ticketId: this.ticketId,
31+
},
32+
});
33+
for await (const item of resourcesStream) {
34+
messages.push(item);
35+
if (this.maxResults && messages.length >= this.maxResults) {
36+
break;
37+
}
38+
}
39+
const length = messages.length;
40+
$.export("$summary", `Successfully retrieved ${length} message${length === 1
41+
? ""
42+
: "s"}`);
43+
return messages;
44+
},
45+
};
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import utils from "../../common/utils.mjs";
2+
import app from "../../trengo.app.mjs";
3+
4+
export default {
5+
key: "trengo-list-tickets",
6+
name: "List Tickets",
7+
description: "List tickets according to the specified criteria. [See the documentation](https://developers.trengo.com/reference/list-all-tickets)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
status: {
13+
type: "string",
14+
label: "Status",
15+
description: "The ticket's status",
16+
optional: true,
17+
options: [
18+
"OPEN",
19+
"ASSIGNED",
20+
"CLOSED",
21+
"INVALID",
22+
],
23+
},
24+
userIds: {
25+
propDefinition: [
26+
app,
27+
"toUserId",
28+
],
29+
type: "integer[]",
30+
label: "User IDs",
31+
description: "Filter by one or more user IDs",
32+
optional: true,
33+
},
34+
channelIds: {
35+
propDefinition: [
36+
app,
37+
"channelId",
38+
],
39+
type: "integer[]",
40+
label: "Channel IDs",
41+
description: "Filter by one or more channel IDs",
42+
optional: true,
43+
},
44+
lastMessageType: {
45+
type: "string",
46+
label: "Last Message Type",
47+
description: "Filter by the type of the last message",
48+
optional: true,
49+
options: [
50+
"INBOUND",
51+
"OUTBOUND",
52+
],
53+
},
54+
sortDirection: {
55+
type: "string",
56+
label: "Sort Direction",
57+
description: "Sort ascending or descending by last message date",
58+
optional: true,
59+
options: [
60+
"ASC",
61+
"DESC",
62+
],
63+
default: "DESC",
64+
},
65+
maxResults: {
66+
type: "integer",
67+
label: "Max Results",
68+
description: "Maximum number of tickets to return (if not specified, all results will be returned)",
69+
optional: true,
70+
},
71+
},
72+
async run({ $ }) {
73+
const tickets = [];
74+
const resourcesStream = utils.getResourcesStream({
75+
resourceFn: this.app.getTickets,
76+
resourceFnArgs: {
77+
params: {
78+
status: this.status,
79+
users: this.userIds,
80+
channels: this.channelIds,
81+
last_message_type: this.lastMessageType,
82+
sort: this.sortDirection === "ASC"
83+
? "date"
84+
: "-date",
85+
},
86+
},
87+
});
88+
for await (const item of resourcesStream) {
89+
tickets.push(item);
90+
if (this.maxResults && tickets.length >= this.maxResults) {
91+
break;
92+
}
93+
}
94+
const length = tickets.length;
95+
$.export("$summary", `Successfully retrieved ${length} ticket${length === 1
96+
? ""
97+
: "s"}`);
98+
return tickets;
99+
},
100+
};

components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import app from "../../trengo.app.mjs";
33
export default {
44
type: "action",
55
key: "trengo-log-a-voice-call",
6-
version: "0.0.3",
6+
version: "0.0.4",
77
name: "Log A Voice Call",
8-
description: "Logs a phone call from external VOIP applications, [See the docs](https://developers.trengo.com/reference/log-a-phone-call)",
8+
description: "Logs a phone call from external VOIP applications, [See the documentation](https://developers.trengo.com/reference/log-a-phone-call)",
99
props: {
1010
app,
1111
channelId: {

components/trengo/actions/send-a-message/send-a-message.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import app from "../../trengo.app.mjs";
33
export default {
44
type: "action",
55
key: "trengo-send-a-message",
6-
version: "0.0.3",
6+
version: "0.0.4",
77
name: "Send A Message",
8-
description: "This action can be used to easily send a message or an email without having to think about contacts or tickets, [See the docs](https://developers.trengo.com/reference/send-a-message-1)",
8+
description: "This action can be used to easily send a message or an email without having to think about contacts or tickets, [See the documentation](https://developers.trengo.com/reference/send-a-message-1)",
99
props: {
1010
app,
1111
channelId: {

components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-send-a-team-chat-message",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
name: "Send A Team Chat Message",
9-
description: "Send a message as a bot in the Team Chat, [See the docs](https://developers.trengo.com/reference/sending-a-bot-message)",
9+
description: "Send a message as a bot in the Team Chat, [See the documentation](https://developers.trengo.com/reference/sending-a-bot-message)",
1010
props: {
1111
app,
1212
threadId: {

components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-send-a-whatsapp-message-template",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
name: "Send A WhatsApp Message Template",
9-
description: "Sends a WhatsApp message template, [See the docs](https://developers.trengo.com/reference/start-a-conversation)",
9+
description: "Sends a WhatsApp message template, [See the documentation](https://developers.trengo.com/reference/start-a-conversation)",
1010
props: {
1111
app,
1212
recepientPhoneNumber: {

components/trengo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/trengo",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Pipedream Trengo Components",
55
"main": "trengo.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)