Skip to content

Commit 22c7276

Browse files
authored
Merging pull request #18742
* updates * pnpm-lock.yaml
1 parent 9c75ce5 commit 22c7276

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

components/freshchat/actions/send-message-in-chat/send-message-in-chat.mjs

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import freshchat from "../../freshchat.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
23

34
export default {
45
key: "freshchat-send-message-in-chat",
56
name: "Send Message in Chat",
67
description: "Sends a message in a specific conversation. [See the documentation](https://developers.freshchat.com/api/#send_message_to_conversation)",
7-
version: "0.0.2",
8+
version: "0.0.3",
89
annotations: {
910
destructiveHint: false,
1011
openWorldHint: true,
@@ -28,13 +29,44 @@ export default {
2829
}),
2930
],
3031
},
32+
actorType: {
33+
type: "string",
34+
label: "Actor Type",
35+
description: "Type of the entity who sent the message to the conversation",
36+
options: [
37+
"user",
38+
"agent",
39+
],
40+
},
41+
agentId: {
42+
propDefinition: [
43+
freshchat,
44+
"agentId",
45+
],
46+
optional: true,
47+
},
3148
message: {
3249
type: "string",
3350
label: "Message",
3451
description: "The content of the message to send",
3552
},
53+
messageType: {
54+
type: "string",
55+
label: "Message Type",
56+
description: "Type of message to be sent to the conversation",
57+
options: [
58+
"normal",
59+
"private",
60+
],
61+
default: "normal",
62+
optional: true,
63+
},
3664
},
3765
async run({ $ }) {
66+
if (this.actorType === "agent" && !this.agentId) {
67+
throw new ConfigurationError("Agent ID is required when actor type is agent");
68+
}
69+
3870
const data = {
3971
message_parts: [
4072
{
@@ -43,9 +75,14 @@ export default {
4375
},
4476
},
4577
],
46-
actor_type: "user",
47-
actor_id: this.userId,
48-
user_id: this.userId,
78+
actor_type: this.actorType,
79+
actor_id: this.actorType === "user"
80+
? this.userId
81+
: this.agentId,
82+
user_id: this.actorType === "user"
83+
? this.userId
84+
: undefined,
85+
message_type: this.messageType,
4986
};
5087
try {
5188
await this.freshchat.sendMessageInChat({

components/freshchat/package.json

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

pnpm-lock.yaml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)