Skip to content

Commit 90c201d

Browse files
Gorgias ticket messages functionality (#19027)
* Sage CRM implementation * Improved Sage CRM * Pr * update pr * Gorgias ticket messages functionality * Updated Pr * remove unecessary files * updates * versions * updates * update messageId prop --------- Co-authored-by: Michelle Bergeron <michelle.bergeron@gmail.com> Co-authored-by: michelle0927 <michelle0927@users.noreply.github.com>
1 parent 72c95a5 commit 90c201d

File tree

23 files changed

+243
-19
lines changed

23 files changed

+243
-19
lines changed

components/gorgias_oauth/actions/create-customer/create-customer.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "gorgias_oauth-create-customer",
66
name: "Create Customer",
77
description: "Create a new customer. [See the docs](https://developers.gorgias.com/reference/post_api-customers)",
8-
version: "0.0.8",
8+
version: "0.0.9",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

components/gorgias_oauth/actions/create-macro/create-macro.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "gorgias_oauth-create-macro",
77
name: "Create Macro",
88
description: "Create a macro. [See the documentation](https://developers.gorgias.com/reference/create-macro)",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
annotations: {
1111
destructiveHint: false,
1212
openWorldHint: true,

components/gorgias_oauth/actions/create-ticket-message/create-ticket-message.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "gorgias_oauth-create-ticket-message",
88
name: "Create Ticket Message",
99
description: "Create a message for a ticket in the Gorgias system. [See the documentation](https://developers.gorgias.com/reference/create-ticket-message)",
10-
version: "0.0.5",
10+
version: "0.0.6",
1111
annotations: {
1212
destructiveHint: false,
1313
openWorldHint: true,

components/gorgias_oauth/actions/create-ticket/create-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gorgias_oauth-create-ticket",
55
name: "Create Ticket",
66
description: "Create a new ticket. [See the docs](https://developers.gorgias.com/reference/post_api-tickets)",
7-
version: "0.0.9",
7+
version: "0.0.10",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/gorgias_oauth/actions/delete-macro/delete-macro.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gorgias_oauth-delete-macro",
55
name: "Delete Macro",
66
description: "Delete a macro. [See the documentation](https://developers.gorgias.com/reference/delete-macro)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: true,
1010
openWorldHint: true,
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import gorgiasOAuth from "../../gorgias_oauth.app.mjs";
2+
3+
export default {
4+
name: "Get Ticket Message",
5+
description: "Get a specific message from a ticket. [See the documentation](https://developers.gorgias.com/reference/get-ticket-message)",
6+
key: "gorgias_oauth-get-ticket-message",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
gorgiasOAuth,
16+
ticketId: {
17+
propDefinition: [
18+
gorgiasOAuth,
19+
"ticketId",
20+
],
21+
},
22+
messageId: {
23+
type: "integer",
24+
label: "Message ID",
25+
description: "The ID of the message to retrieve",
26+
async options({ prevContext }) {
27+
const {
28+
data: messages,
29+
meta,
30+
} = await this.gorgiasOAuth.listTicketMessages({
31+
ticketId: this.ticketId,
32+
params: {
33+
cursor: prevContext.nextCursor,
34+
},
35+
});
36+
return {
37+
options: messages.map(({
38+
id: value, subject: label,
39+
}) => ({
40+
label,
41+
value: +value,
42+
})),
43+
context: {
44+
nextCursor: meta.next_cursor,
45+
},
46+
};
47+
},
48+
},
49+
},
50+
async run({ $ }) {
51+
const response = await this.gorgiasOAuth.getTicketMessage({
52+
$,
53+
ticketId: this.ticketId,
54+
messageId: this.messageId,
55+
});
56+
57+
$.export("$summary", `Successfully retrieved message ${this.messageId} from ticket ${this.ticketId}`);
58+
59+
return response;
60+
},
61+
};

components/gorgias_oauth/actions/get-ticket/get-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gorgias_oauth-get-ticket",
55
name: "Get Ticket",
66
description: "Get a ticket. [See the documentation](https://developers.gorgias.com/reference/get-ticket)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/gorgias_oauth/actions/list-macros/list-macros.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gorgias_oauth-list-macros",
55
name: "List Macros",
66
description: "List all macros. [See the documentation](https://developers.gorgias.com/reference/list-macros)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import gorgiasOAuth from "../../gorgias_oauth.app.mjs";
2+
3+
export default {
4+
name: "List Messages",
5+
description: "List all messages. [See the documentation](https://developers.gorgias.com/reference/list-messages)",
6+
key: "gorgias_oauth-list-messages",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
gorgiasOAuth,
16+
limit: {
17+
type: "integer",
18+
label: "Limit",
19+
description: "Maximum number of messages to return (1-100)",
20+
min: 1,
21+
max: 100,
22+
default: 50,
23+
},
24+
cursor: {
25+
type: "string",
26+
label: "Cursor",
27+
description: "Cursor for pagination (get from the meta.next_cursor of the previous response)",
28+
optional: true,
29+
},
30+
},
31+
async run({ $ }) {
32+
const params = {
33+
limit: this.limit,
34+
};
35+
36+
if (this.cursor) {
37+
params.cursor = this.cursor;
38+
}
39+
40+
const response = await this.gorgiasOAuth.listMessages({
41+
$,
42+
params,
43+
});
44+
45+
$.export("$summary", `Successfully retrieved ${response.data.length} message${response.data.length === 1
46+
? ""
47+
: "s"}`);
48+
49+
// Return the data and pagination info
50+
return {
51+
data: response.data,
52+
meta: response.meta,
53+
};
54+
},
55+
};
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import gorgiasOAuth from "../../gorgias_oauth.app.mjs";
2+
3+
export default {
4+
name: "List Ticket Messages",
5+
description: "List all messages for a specific ticket. [See the documentation](https://developers.gorgias.com/reference/list-ticket-messages)",
6+
key: "gorgias_oauth-list-ticket-messages",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
gorgiasOAuth,
16+
ticketId: {
17+
propDefinition: [
18+
gorgiasOAuth,
19+
"ticketId",
20+
],
21+
},
22+
limit: {
23+
type: "integer",
24+
label: "Limit",
25+
description: "Maximum number of messages to return (1-100)",
26+
min: 1,
27+
max: 100,
28+
default: 50,
29+
},
30+
cursor: {
31+
type: "string",
32+
label: "Cursor",
33+
description: "Cursor for pagination (get from the meta.next_cursor of the previous response)",
34+
optional: true,
35+
},
36+
},
37+
async run({ $ }) {
38+
const params = {
39+
limit: this.limit,
40+
};
41+
42+
if (this.cursor) {
43+
params.cursor = this.cursor;
44+
}
45+
46+
const response = await this.gorgiasOAuth.listTicketMessages({
47+
$,
48+
ticketId: this.ticketId,
49+
params,
50+
});
51+
52+
$.export("$summary", `Successfully retrieved ${response.data.length} message${response.data.length === 1
53+
? ""
54+
: "s"}`);
55+
56+
// Return the data and pagination info
57+
return {
58+
data: response.data,
59+
meta: response.meta,
60+
};
61+
},
62+
};

0 commit comments

Comments
 (0)