Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import app from "../../trengo.app.mjs";
export default {
type: "action",
key: "trengo-create-contact",
version: "0.0.3",
version: "0.0.4",
name: "Create Contact",
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)",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/trengo/actions/find-contacts/find-contacts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
export default {
type: "action",
key: "trengo-find-contacts",
version: "0.0.3",
version: "0.0.4",
name: "Find Contacts",
description: "Finds contacts with the given term. [See the docs](https://developers.trengo.com/reference/as)",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/trengo/actions/list-articles/list-articles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
export default {
type: "action",
key: "trengo-list-articles",
version: "0.0.1",
version: "0.0.2",
name: "List Articles",
description: "List articles from a help center according to the specified criteria. [See the docs](https://developers.trengo.com/reference/list-all-articles)",
props: {
Expand Down
45 changes: 45 additions & 0 deletions components/trengo/actions/list-messages/list-messages.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import utils from "../../common/utils.mjs";
import app from "../../trengo.app.mjs";

export default {
key: "trengo-list-messages",
name: "List Messages",
description: "List messages from a ticket. [See the documentation](https://developers.trengo.com/reference/list-all-messages)",
version: "0.0.1",
type: "action",
props: {
app,
ticketId: {
propDefinition: [
app,
"ticketId",
],
},
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of messages to return (if not specified, all results will be returned)",
optional: true,
},
},
async run({ $ }) {
const messages = [];
const resourcesStream = utils.getResourcesStream({
resourceFn: this.app.getMessages,
resourceFnArgs: {
ticketId: this.ticketId,
},
});
for await (const item of resourcesStream) {
messages.push(item);
if (this.maxResults && messages.length >= this.maxResults) {
break;
}
}
const length = messages.length;
$.export("$summary", `Successfully retrieved ${length} message${length === 1
? ""
: "s"}`);
return messages;
},
};
98 changes: 98 additions & 0 deletions components/trengo/actions/list-tickets/list-tickets.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import utils from "../../common/utils.mjs";
import app from "../../trengo.app.mjs";

export default {
key: "trengo-list-tickets",
name: "List Tickets",
description: "List tickets according to the specified criteria. [See the documentation](https://developers.trengo.com/reference/list-all-tickets)",
version: "0.0.1",
type: "action",
props: {
app,
status: {
type: "string",
label: "Status",
description: "The ticket's status",
optional: true,
options: [
"OPEN",
"ASSIGNED",
"CLOSED",
"INVALID",
],
},
userIds: {
propDefinition: [
app,
"toUserId",
],
label: "User IDs",
description: "Filter by one or more user IDs",
optional: true,
},
channelIds: {
propDefinition: [
app,
"channelId",
],
label: "Channel IDs",
description: "Filter by one or more channel IDs",
optional: true,
},
lastMessageType: {
type: "string",
label: "Last Message Type",
description: "Filter by the type of the last message",
optional: true,
options: [
"INBOUND",
"OUTBOUND",
],
},
sortDirection: {
type: "string",
label: "Sort Direction",
description: "Sort ascending or descending by last message date",
optional: true,
options: [
"ASC",
"DESC",
],
default: "DESC",
},
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of articles to return (if not specified, all results will be returned)",
optional: true,
},
},
async run({ $ }) {
const tickets = [];
const resourcesStream = utils.getResourcesStream({
resourceFn: this.app.getTickets,
resourceFnArgs: {
params: {
status: this.status,
users: this.userIds,
channels: this.channelIds,
last_message_type: this.lastMessageType,
sort: this.sortDirection === "ASC"
? "date"
: "-date",
},
},
});
for await (const item of resourcesStream) {
tickets.push(item);
if (this.maxResults && tickets.length >= this.maxResults) {
break;
}
}
const length = tickets.length;
$.export("$summary", `Successfully retrieved ${length} ticket${length === 1
? ""
: "s"}`);
return tickets;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import app from "../../trengo.app.mjs";
export default {
type: "action",
key: "trengo-log-a-voice-call",
version: "0.0.3",
version: "0.0.4",
name: "Log A Voice Call",
description: "Logs a phone call from external VOIP applications, [See the docs](https://developers.trengo.com/reference/log-a-phone-call)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import app from "../../trengo.app.mjs";
export default {
type: "action",
key: "trengo-send-a-message",
version: "0.0.3",
version: "0.0.4",
name: "Send A Message",
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)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
export default {
type: "action",
key: "trengo-send-a-team-chat-message",
version: "0.0.3",
version: "0.0.4",
name: "Send A Team Chat Message",
description: "Send a message as a bot in the Team Chat, [See the docs](https://developers.trengo.com/reference/sending-a-bot-message)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import app from "../../trengo.app.mjs";
export default {
type: "action",
key: "trengo-send-a-whatsapp-message-template",
version: "0.0.3",
version: "0.0.4",
name: "Send A WhatsApp Message Template",
description: "Sends a WhatsApp message template, [See the docs](https://developers.trengo.com/reference/start-a-conversation)",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/trengo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/trengo",
"version": "0.2.0",
"version": "0.3.0",
"description": "Pipedream Trengo Components",
"main": "trengo.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-new-inbound-message",
name: "New Inbound Message Event (Instant)",
description: "Emit new events when an inbound message received. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-new-internal-note",
name: "New Internal Note Event (Instant)",
description: "Emit new events when a internal note added. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-new-outbound-message",
name: "New Outbound Message Event (Instant)",
description: "Emit new events when an outbound message sent. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-phone-call-ended",
name: "New Phone Call Ended Event (Instant)",
description: "Emit new events when an phone call ended. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-phone-call-missed",
name: "New Phone Call Missed Event (Instant)",
description: "Emit new events when an phone call missed. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-phone-call-started",
name: "New Phone Call Started Event (Instant)",
description: "Emit new events when an phone call started. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
2 changes: 1 addition & 1 deletion components/trengo/sources/ticket-closed/ticket-closed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

export default {
key: "trengo-ticket-closed",
name: "Ticket Closed (Instant)",

Check warning on line 5 in components/trengo/sources/ticket-closed/ticket-closed.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a ticket is closed. [See the documentation](https://developers.trengo.com/docs/webhooks)",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-ticket-label-added",
name: "New Ticket Label Added Event (Instant)",
description: "Emit new events when a ticket label added. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

export default {
key: "trengo-ticket-reopened",
name: "Ticket Reopened (Instant)",

Check warning on line 5 in components/trengo/sources/ticket-reopened/ticket-reopened.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a ticket is reopened. [See the documentation](https://developers.trengo.com/docs/webhooks)",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
...common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "trengo-voice-call-recorded",
name: "New Voice Call Recorded Event (Instant)",
description: "Emit new events when a voice call is recorded. [See the docs here](https://developers.trengo.com/docs/webhooks)",
version: "0.0.2",
version: "0.0.3",
type: "source",
dedupe: "unique",
...common,
Expand Down
8 changes: 8 additions & 0 deletions components/trengo/trengo.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,13 @@ export default {
...args,
});
},
async getMessages({
ticketId, ...args
}) {
return this._makeRequest({
path: `/tickets/${ticketId}/messages`,
...args,
});
},
},
};
Loading