Skip to content

Commit a70a343

Browse files
authored
Merging pull request #17792
* Trengo package + pnpm * Adding 'List Articles' action * Adding Ticket Closed and Ticket Reopened sources * Adding 'maxResults' to List Articles * Version bumps * Minor adjustments
1 parent cdbceec commit a70a343

File tree

19 files changed

+199
-19
lines changed

19 files changed

+199
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import app from "../../trengo.app.mjs";
33
export default {
44
type: "action",
55
key: "trengo-create-contact",
6-
version: "0.0.2",
6+
version: "0.0.3",
77
name: "Create Contact",
88
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)",
99
props: {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-find-contacts",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
name: "Find Contacts",
99
description: "Finds contacts with the given term. [See the docs](https://developers.trengo.com/reference/as)",
1010
props: {
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import utils from "../../common/utils.mjs";
2+
import app from "../../trengo.app.mjs";
3+
4+
export default {
5+
type: "action",
6+
key: "trengo-list-articles",
7+
version: "0.0.1",
8+
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)",
10+
props: {
11+
app,
12+
helpCenterId: {
13+
propDefinition: [
14+
app,
15+
"helpCenterId",
16+
],
17+
},
18+
localeCode: {
19+
type: "string",
20+
label: "Locale Code",
21+
description: "The article's locale code",
22+
optional: true,
23+
default: "en",
24+
},
25+
filter: {
26+
type: "string",
27+
label: "Filter",
28+
description: "The article's filter. You can choose one of the available options, specify `untranslated_<language_code>` for other language codes, or leave empty for all articles",
29+
optional: true,
30+
options: [
31+
"draft",
32+
"published",
33+
"untranslated_en",
34+
],
35+
},
36+
term: {
37+
type: "string",
38+
label: "Search Term",
39+
description: "The article's search term (if not specified, all articles will be returned)",
40+
optional: true,
41+
},
42+
maxResults: {
43+
type: "integer",
44+
label: "Max Results",
45+
description: "Maximum number of articles to return (if not specified, all results will be returned)",
46+
optional: true,
47+
},
48+
},
49+
async run({ $ }) {
50+
const articles = [];
51+
const resourcesStream = utils.getResourcesStream({
52+
resourceFn: this.app.getArticles,
53+
resourceFnArgs: {
54+
helpCenterId: this.helpCenterId,
55+
params: {
56+
localeCode: this.localeCode,
57+
filter: this.filter,
58+
term: this.term,
59+
},
60+
},
61+
});
62+
for await (const item of resourcesStream) {
63+
articles.push(item);
64+
if (this.maxResults && articles.length >= this.maxResults) {
65+
break;
66+
}
67+
}
68+
const length = articles.length;
69+
$.export("$summary", `Successfully retrieved ${length} article${length === 1
70+
? ""
71+
: "s"}`);
72+
return articles;
73+
},
74+
};

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import app from "../../trengo.app.mjs";
33
export default {
44
type: "action",
55
key: "trengo-send-a-message",
6-
version: "0.0.2",
6+
version: "0.0.3",
77
name: "Send A Message",
88
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)",
99
props: {

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

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

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
44
export default {
55
type: "action",
66
key: "trengo-send-a-whatsapp-message-template",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
name: "Send A WhatsApp Message Template",
99
description: "Sends a WhatsApp message template, [See the docs](https://developers.trengo.com/reference/start-a-conversation)",
1010
props: {
@@ -45,7 +45,7 @@ export default {
4545
},
4646
async run ({ $ }) {
4747
if (!this.recepientPhoneNumber && !this.ticketId) {
48-
throw new ConfigurationError("Either `Receipent Phone Number` or `Ticket ID` should be set!");
48+
throw new ConfigurationError("Either `Recipient Phone Number` or `Ticket ID` should be set!");
4949
}
5050
const params = [];
5151
if (this.whatsappTemplateParamsKeys && this.whatsappTemplateParamsValues) {
@@ -65,7 +65,8 @@ export default {
6565
data: {
6666
recipient_phone_number: this.recepientPhoneNumber,
6767
hsm_id: this.hsmId,
68-
ticket_id: this.ticketId,
68+
// the docs specify this as string for some reason
69+
ticket_id: this.ticketId?.toString?.() || this.ticketId,
6970
params,
7071
},
7172
});

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.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream Trengo Components",
55
"main": "trengo.app.mjs",
66
"keywords": [

components/trengo/sources/new-inbound-message/new-inbound-message.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "trengo-new-inbound-message",
55
name: "New Inbound Message Event (Instant)",
66
description: "Emit new events when an inbound message received. [See the docs here](https://developers.trengo.com/docs/webhooks)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "source",
99
dedupe: "unique",
1010
...common,

components/trengo/sources/new-internal-note/new-internal-note.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "trengo-new-internal-note",
55
name: "New Internal Note Event (Instant)",
66
description: "Emit new events when a internal note added. [See the docs here](https://developers.trengo.com/docs/webhooks)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "source",
99
dedupe: "unique",
1010
...common,

0 commit comments

Comments
 (0)