-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Expand file tree
/
Copy pathcreate-solution-article.mjs
More file actions
77 lines (76 loc) · 1.93 KB
/
create-solution-article.mjs
File metadata and controls
77 lines (76 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import freshdesk from "../../freshdesk.app.mjs";
import constants from "../../common/constants.mjs";
import { parseObject } from "../../common/utils.mjs";
export default {
key: "freshdesk-create-solution-article",
name: "Create Solution Article",
description: "Create a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)",
version: "0.0.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
freshdesk,
categoryId: {
propDefinition: [
freshdesk,
"categoryId",
],
},
folderId: {
propDefinition: [
freshdesk,
"folderId",
(c) => ({
categoryId: c.categoryId,
}),
],
},
title: {
type: "string",
label: "Title",
description: "Title of the article",
},
description: {
type: "string",
label: "Description",
description: "Description of the article",
},
status: {
type: "integer",
label: "Status",
description: "Status of the article",
options: constants.ARTICLE_STATUS,
},
seoData: {
type: "object",
label: "SEO Data",
description: "Meta data for search engine optimization. Allows meta_title, meta_description and meta_keywords",
optional: true,
},
tags: {
type: "string[]",
label: "Tags",
description: "Tags for the article",
optional: true,
},
},
async run({ $ }) {
const response = await this.freshdesk.createArticle({
$,
folderId: this.folderId,
data: {
title: this.title,
description: this.description,
status: this.status,
seo_data: parseObject(this.seoData),
tags: this.tags,
},
});
$.export("$summary", `Successfully created solution article ${this.title}`);
return response;
},
};