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
2 changes: 1 addition & 1 deletion components/azure_storage/azure_storage.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/elevio/elevio.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/homerun/homerun.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/ragie/ragie.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/refiner/refiner.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import richpanel from "../../richpanel.app.mjs";

export default {
key: "richpanel-add-ticket-message",
name: "Add Ticket Message",
description: "Adds a message to an existing ticket. [See the documentation](https://developer.richpanel.com/reference/update-a-conversation)",
version: "0.0.1",
type: "action",
props: {
richpanel,
conversationId: {
propDefinition: [
richpanel,
"conversationId",
],
},
commentBody: {
propDefinition: [
richpanel,
"commentBody",
],
},
commentSenderType: {
propDefinition: [
richpanel,
"commentSenderType",
],
},
},
async run({ $ }) {
const response = await this.richpanel.updateTicket({
$,
conversationId: this.conversationId,
data: {
ticket: {
comment: {
body: this.commentBody,
sender_type: this.commentSenderType,
},
},
},
});
$.export("$summary", `Added message to ticket ${this.conversationId} successfully`);
return response;
},
};
206 changes: 206 additions & 0 deletions components/richpanel/actions/create-ticket/create-ticket.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import { ConfigurationError } from "@pipedream/platform";
import { VIA_CHANNEL_OPTIONS } from "../../common/constants.mjs";
import { parseObject } from "../../common/utils.mjs";
import richpanel from "../../richpanel.app.mjs";

export default {
key: "richpanel-create-ticket",
name: "Create Ticket",
description: "Creates a new support ticket in Richpanel. [See the documentation](https://developer.richpanel.com/reference/create-conversation).",
version: "0.0.1",
type: "action",
props: {
richpanel,
id: {
propDefinition: [
richpanel,
"createId",
],
optional: true,
},
status: {
propDefinition: [
richpanel,
"status",
],
},
subject: {
type: "string",
label: "Subject",
description: "The subject of the ticket.",
optional: true,
},
commentBody: {
propDefinition: [
richpanel,
"commentBody",
],
},
priority: {
type: "string",
label: "Priority",
description: "The priority of the ticket.",
options: [
"HIGH",
"LOW",
],
optional: true,
},
commentSenderType: {
propDefinition: [
richpanel,
"commentSenderType",
],
},
viaChannel: {
type: "string",
label: "Via Channel",
description: "The channel via which the ticket is created.",
reloadProps: true,
options: VIA_CHANNEL_OPTIONS,
},
viaSourceFromAddress: {
type: "string",
label: "Via Source From Address",
description: "The email address of the source from.",
hidden: true,
},
viaSourceFromName: {
type: "string",
label: "Via Source From Name",
description: "The name of the source from.",
hidden: true,
},
viaSourceToAddress: {
type: "string",
label: "Via Source To Address",
description: "The email address of the source to.",
hidden: true,
},
viaSourceToName: {
type: "string",
label: "Via Source To Name",
description: "The name of the source to.",
hidden: true,
},
viaSourceFromNumber: {
type: "string",
label: "Via Source From Number",
description: "The phone number of the source from.",
hidden: true,
},
viaSourceToNumber: {
type: "string",
label: "Via Source To Number",
description: "The phone number of the source to.",
hidden: true,
},
viaSourceFrom: {
type: "object",
label: "Via Source From",
description: "The object source from which the ticket was created. **Examples: {\"address\": \"[email protected]\"} or {\"id\": \"+16692668044\"}. It depends on the selected channel**.",
hidden: true,
},
viaSourceTo: {
type: "object",
label: "Via Source To",
description: "The object source to which the ticket was created. **Examples: {\"address\": \"[email protected]\"} or {\"id\": \"+16692668044\"}. It depends on the selected channel**.",
hidden: true,
},
tags: {
propDefinition: [
richpanel,
"tags",
],
optional: true,
},
},
async additionalProps(props) {
switch (this.viaChannel) {
case "email" :
props.viaSourceFromAddress.hidden = false;
props.viaSourceFromName.hidden = false;
props.viaSourceToAddress.hidden = false;
props.viaSourceToName.hidden = false;
props.viaSourceFrom.hidden = true;
props.viaSourceTo.hidden = true;
props.viaSourceFromNumber.hidden = true;
props.viaSourceToNumber.hidden = true;
break;
case "aircall" :
props.viaSourceFromNumber.hidden = false;
props.viaSourceToNumber.hidden = false;
props.viaSourceFrom.hidden = true;
props.viaSourceTo.hidden = true;
props.viaSourceFromAddress.hidden = true;
props.viaSourceFromName.hidden = true;
props.viaSourceToAddress.hidden = true;
props.viaSourceToName.hidden = true;
break;
default:
props.viaSourceFrom.hidden = false;
props.viaSourceTo.hidden = false;
props.viaSourceFromAddress.hidden = true;
props.viaSourceFromName.hidden = true;
props.viaSourceToAddress.hidden = true;
props.viaSourceToName.hidden = true;
props.viaSourceFromNumber.hidden = true;
props.viaSourceToNumber.hidden = true;
}
return {};
},
async run({ $ }) {
try {
const source = {};
switch (this.viaChannel) {
case "email" :
source.from = {
address: this.viaSourceFromAddress,
name: this.viaSourceFromName,
};
source.to = {
address: this.viaSourceToAddress,
name: this.viaSourceToName,
};
break;
case "aircall" :
source.from = {
id: this.viaSourceFromNumber,
};
source.to = {
id: this.viaSourceToNumber,
};
break;
default:
source.from = parseObject(this.viaSourceFrom);
source.to = parseObject(this.viaSourceTo);
}

const response = await this.richpanel.createTicket({
$,
data: {
ticket: {
id: this.id,
status: this.status,
subject: this.subject,
comment: {
body: this.commentBody,
sender_type: this.commentSenderType,
},
priority: this.priority,
via: {
channel: this.viaChannel,
source,
},
tags: parseObject(this.tags),
},
},
});

$.export("$summary", `Created ticket ${response.ticket.id}`);
return response;
} catch ({ response }) {
throw new ConfigurationError(response?.data?.error?.message);
}
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import richpanel from "../../richpanel.app.mjs";

export default {
key: "richpanel-update-ticket-status",
name: "Update Ticket Status",
description: "Updates the status of an existing ticket in Richpanel. [See the documentation](https://developer.richpanel.com/reference/update-a-conversation).",
version: "0.0.1",
type: "action",
props: {
richpanel,
conversationId: {
propDefinition: [
richpanel,
"conversationId",
],
},
status: {
propDefinition: [
richpanel,
"status",
],
},
},
async run({ $ }) {
const response = await this.richpanel.updateTicket({
$,
conversationId: this.conversationId,
data: {
ticket: {
status: this.status,
},
},
});
$.export("$summary", `Updated ticket ${this.conversationId} to status ${this.status}`);
return response;
},
};
52 changes: 52 additions & 0 deletions components/richpanel/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export const STATUS_OPTIONS = [
{
label: "Open",
value: "OPEN",
},
{
label: "Closed",
value: "CLOSED",
},
];

export const COMMENT_SENDER_TYPE_OPTIONS = [
{
label: "Customer",
value: "customer",
},
{
label: "Operator",
value: "operator",
},
];

export const VIA_CHANNEL_OPTIONS = [
{
label: "Email",
value: "email",
},
{
label: "Messenger",
value: "messenger",
},
{
label: "Facebook Message",
value: "facebook_message",
},
{
label: "Instagram",
value: "instagram",
},
{
label: "Aircall",
value: "aircall",
},
{
label: "Phone",
value: "phone",
},
{
label: "WhatsApp",
value: "whatsapp",
},
];
Loading
Loading