Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
68 changes: 68 additions & 0 deletions components/freshchat/actions/list-messages/list-messages.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import app from "../../freshchat.app.mjs";

export default {
key: "freshchat-list-messages",
name: "List Messages",
description: "Lists all messages in a conversation. [See the documentation](https://developers.freshchat.com/api/#list_messages)",
type: "action",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
app,
userId: {
propDefinition: [
app,
"userId",
],
},
conversationId: {
propDefinition: [
app,
"conversationId",
({ userId }) => ({
userId,
}),
],
},
fromTime: {
type: "string",
label: "From Time",
description: "UTC datetime to retrieve messages after this timestamp (ISO 8601 format). Example: `2025-01-01T00:00:00Z`.",
optional: true,
},
maxResults: {
propDefinition: [
app,
"maxResults",
],
},
},
async run({ $ }) {
const {
app,
conversationId,
fromTime,
maxResults,
} = this;

const response = await app.getPaginatedResults({
fn: app.listMessages,
args: {
$,
conversationId,
params: {
from_time: fromTime,
},
},
resourceKey: "messages",
max: maxResults,
});

$.export("$summary", `Listed ${response.length} message(s)`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/freshchat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/freshchat",
"version": "0.1.1",
"version": "0.2.0",
"description": "Pipedream Freshchat Components",
"main": "freshchat.app.mjs",
"keywords": [
Expand Down
Loading
Loading