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
Expand Up @@ -5,7 +5,7 @@ export default {
key: "gorgias_oauth-create-customer",
name: "Create Customer",
description: "Create a new customer. [See the docs](https://developers.gorgias.com/reference/post_api-customers)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
gorgias_oauth,
Expand Down
61 changes: 61 additions & 0 deletions components/gorgias_oauth/actions/create-macro/create-macro.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import gorgias_oauth from "../../gorgias_oauth.app.mjs";
import { parseObject } from "../../common/utils.mjs";
import constants from "../../common/constants.mjs";

export default {
key: "gorgias_oauth-create-macro",
name: "Create Macro",
description: "Create a macro. [See the documentation](https://developers.gorgias.com/reference/create-macro)",
version: "0.0.1",
type: "action",
props: {
gorgias_oauth,
name: {
type: "string",
label: "Name",
description: "The name of the Macro. Tips: choose a name that can be easily searched.",
},
intent: {
type: "string",
label: "Intent",
description: "The intention of the macro should be used for",
optional: true,
options: constants.macroIntents,
},
language: {
propDefinition: [
gorgias_oauth,
"language",
],
description: "The language of the macro",
},
actions: {
type: "string[]",
label: "Actions",
description: `A list of actions to be applied on tickets. [See the documentation](https://developers.gorgias.com/reference/create-macro) for more info.
\nExample: [{
"arguments": {
"tags": "question, order-status"
},
"name": "addTags",
"title": "add tags",
"type": "user"
}]`,
optional: true,
},
},
async run({ $ }) {
const data = {
name: this.name,
intent: this.intent,
language: this.language,
actions: parseObject(this.actions),
};
const response = await this.gorgias_oauth.createMacro({
$,
data,
});
$.export("$summary", `Successfully created macro ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "gorgias_oauth-create-ticket-message",
name: "Create Ticket Message",
description: "Create a message for a ticket in the Gorgias system. [See the documentation](https://developers.gorgias.com/reference/create-ticket-message)",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
gorgiasOauth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gorgias_oauth-create-ticket",
name: "Create Ticket",
description: "Create a new ticket. [See the docs](https://developers.gorgias.com/reference/post_api-tickets)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
gorgias_oauth,
Expand Down
26 changes: 26 additions & 0 deletions components/gorgias_oauth/actions/delete-macro/delete-macro.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import gorgias_oauth from "../../gorgias_oauth.app.mjs";

export default {
key: "gorgias_oauth-delete-macro",
name: "Delete Macro",
description: "Delete a macro. [See the documentation](https://developers.gorgias.com/reference/delete-macro)",
version: "0.0.1",
type: "action",
props: {
gorgias_oauth,
macroId: {
propDefinition: [
gorgias_oauth,
"macroId",
],
},
},
async run({ $ }) {
const response = await this.gorgias_oauth.deleteMacro({
$,
id: this.macroId,
});
$.export("$summary", `Successfully deleted macro ${this.macroId}`);
return response;
},
};
27 changes: 27 additions & 0 deletions components/gorgias_oauth/actions/get-ticket/get-ticket.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import gorgias_oauth from "../../gorgias_oauth.app.mjs";

export default {
key: "gorgias_oauth-get-ticket",
name: "Get Ticket",
description: "Get a ticket. [See the documentation](https://developers.gorgias.com/reference/get-ticket)",
version: "0.0.1",
type: "action",
props: {
gorgias_oauth,
ticketId: {
propDefinition: [
gorgias_oauth,
"ticketId",
],
description: "The ID of a ticket to get",
},
},
async run({ $ }) {
const response = await this.gorgias_oauth.retrieveTicket({
$,
id: this.ticketId,
});
$.export("$summary", `Successfully retrieved ticket with ID: ${this.ticketId}`);
return response;
},
};
46 changes: 46 additions & 0 deletions components/gorgias_oauth/actions/list-macros/list-macros.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import gorgias_oauth from "../../gorgias_oauth.app.mjs";

export default {
key: "gorgias_oauth-list-macros",
name: "List Macros",
description: "List all macros. [See the documentation](https://developers.gorgias.com/reference/list-macros)",
version: "0.0.1",
type: "action",
props: {
gorgias_oauth,
search: {
type: "string",
label: "Search",
description: "Filter macros containing the given search query",
optional: true,
},
limit: {
propDefinition: [
gorgias_oauth,
"limit",
],
},
},
async run({ $ }) {
const params = {
search: this.search,
limit: this.limit,
};

const macros = [];
const paginator = this.gorgias_oauth.paginate({
$,
fn: this.gorgias_oauth.listMacros,
params,
});
for await (const macro of paginator) {
macros.push(macro);
}

const suffix = macros.length === 1
? ""
: "s";
$.export("$summary", `Returned ${macros.length} macro${suffix}`);
return macros;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gorgias_oauth-list-tickets",
name: "List Tickets",
description: "List all tickets. [See the docs](https://developers.gorgias.com/reference/get_api-tickets)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
gorgias_oauth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gorgias_oauth-retrieve-customer",
name: "Retrieve a Customer",
description: "Retrieve a customer. [See the docs](https://developers.gorgias.com/reference/get_api-customers-id-)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
gorgias_oauth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
key: "gorgias_oauth-update-customer",
name: "Update Customer",
description: "Update a customer. [See the docs](https://developers.gorgias.com/reference/put_api-customers-id-)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
gorgias_oauth,
Expand Down
73 changes: 73 additions & 0 deletions components/gorgias_oauth/actions/update-macro/update-macro.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import gorgias_oauth from "../../gorgias_oauth.app.mjs";
import constants from "../../common/constants.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "gorgias_oauth-update-macro",
name: "Update Macro",
description: "Update a macro. [See the documentation](https://developers.gorgias.com/reference/update-macro)",
version: "0.0.1",
type: "action",
props: {
gorgias_oauth,
macroId: {
propDefinition: [
gorgias_oauth,
"macroId",
],
},
name: {
type: "string",
label: "Name",
description: "The name of the Macro. Tips: choose a name that can be easily searched.",
optional: true,
},
intent: {
type: "string",
label: "Intent",
description: "The intention of the macro should be used for",
optional: true,
options: constants.macroIntents,
},
language: {
propDefinition: [
gorgias_oauth,
"language",
],
description: "The language of the macro",
},
actions: {
type: "string[]",
label: "Actions",
description: `A list of actions to be applied on tickets. [See the documentation](https://developers.gorgias.com/reference/create-macro) for more info.
\nExample: [{
"arguments": {
"tags": "question, order-status"
},
"name": "addTags",
"title": "add tags",
"type": "user"
}]`,
optional: true,
},
},
async run({ $ }) {
const macro = await this.gorgias_oauth.getMacro({
$,
id: this.macroId,
});
const data = {
name: this.name || macro.name,
intent: this.intent,
language: this.language,
actions: parseObject(this.actions),
};
const response = await this.gorgias_oauth.updateMacro({
$,
id: this.macroId,
data,
});
$.export("$summary", `Successfully updated macro ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "gorgias_oauth-update-ticket",
name: "Update Ticket",
description: "Updates a predefined ticket in the Gorgias system. [See the documentation](https://developers.gorgias.com/reference/update-ticket)",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
gorgiasOauth,
Expand Down
28 changes: 28 additions & 0 deletions components/gorgias_oauth/common/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,36 @@ const sourceTypes = [
"whatsapp-message",
];

const macroIntents = [
"discount/request",
"exchange/request",
"exchange/status",
"feedback",
"order/damaged",
"order/cancel",
"order/change",
"order/wrong",
"other/no_reply",
"other/question",
"other/thanks",
"product/recommendation",
"product/question",
"refund/request",
"refund/status",
"return/request",
"return/status",
"shipping/change",
"shipping/delivery-issue",
"shipping/policy",
"shipping/status",
"stock/request",
"subscription/cancel",
"subscription/change",
];

export default {
channels,
vias,
sourceTypes,
macroIntents,
};
Loading
Loading