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
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import freshchat from "../../freshchat.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "freshchat-send-message-in-chat",
name: "Send Message in Chat",
description: "Sends a message in a specific conversation. [See the documentation](https://developers.freshchat.com/api/#send_message_to_conversation)",
version: "0.0.2",
version: "0.0.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand All @@ -28,13 +29,44 @@ export default {
}),
],
},
actorType: {
type: "string",
label: "Actor Type",
description: "Type of the entity who sent the message to the conversation",
options: [
"user",
"agent",
],
},
agentId: {
propDefinition: [
freshchat,
"agentId",
],
optional: true,
},
message: {
type: "string",
label: "Message",
description: "The content of the message to send",
},
messageType: {
type: "string",
label: "Message Type",
description: "Type of message to be sent to the conversation",
options: [
"normal",
"private",
],
default: "normal",
optional: true,
},
},
async run({ $ }) {
if (this.actorType === "agent" && !this.agentId) {
throw new ConfigurationError("Agent ID is required when actor type is agent");
}

const data = {
message_parts: [
{
Expand All @@ -43,9 +75,14 @@ export default {
},
},
],
actor_type: "user",
actor_id: this.userId,
user_id: this.userId,
actor_type: this.actorType,
actor_id: this.actorType === "user"
? this.userId
: this.agentId,
user_id: this.actorType === "user"
? this.userId
: undefined,
message_type: this.messageType,
};
try {
await this.freshchat.sendMessageInChat({
Expand Down
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.0",
"version": "0.1.1",
"description": "Pipedream Freshchat Components",
"main": "freshchat.app.mjs",
"keywords": [
Expand Down
105 changes: 7 additions & 98 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading